Revert "Unify workspace dropdowns; Update layouts (#458)"
This reverts commit 4bc8448a1d.
This commit is contained in:
@@ -306,16 +306,16 @@ function getAuthErrorMessage(params: { error: string; code?: string }) {
|
||||
// this error arises when the user tries to sign in with an expired email link
|
||||
if (params.code) {
|
||||
if (params.code === 'otp_expired') {
|
||||
return 'auth.errors.otp_expired';
|
||||
return 'auth:errors.otp_expired';
|
||||
}
|
||||
}
|
||||
|
||||
// this error arises when the user is trying to sign in with a different
|
||||
// browser than the one they used to request the sign in link
|
||||
if (isVerifierError(params.error)) {
|
||||
return 'auth.errors.codeVerifierMismatch';
|
||||
return 'auth:errors.codeVerifierMismatch';
|
||||
}
|
||||
|
||||
// fallback to the default error message
|
||||
return `auth.authenticationErrorAlertBody`;
|
||||
return `auth:authenticationErrorAlertBody`;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'server-only';
|
||||
|
||||
import * as z from 'zod';
|
||||
import { z } from 'zod';
|
||||
|
||||
const message =
|
||||
'Invalid Supabase Secret Key. Please add the environment variable SUPABASE_SECRET_KEY.';
|
||||
'Invalid Supabase Secret Key. Please add the environment variable SUPABASE_SECRET_KEY or SUPABASE_SERVICE_ROLE_KEY.';
|
||||
|
||||
/**
|
||||
* @name getSupabaseSecretKey
|
||||
@@ -13,12 +13,14 @@ const message =
|
||||
export function getSupabaseSecretKey() {
|
||||
return z
|
||||
.string({
|
||||
error: message,
|
||||
required_error: message,
|
||||
})
|
||||
.min(1, {
|
||||
message: message,
|
||||
})
|
||||
.parse(process.env.SUPABASE_SECRET_KEY);
|
||||
.parse(
|
||||
process.env.SUPABASE_SECRET_KEY || process.env.SUPABASE_SERVICE_ROLE_KEY,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as z from 'zod';
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* Returns and validates the Supabase client keys from the environment.
|
||||
@@ -7,14 +7,18 @@ export function getSupabaseClientKeys() {
|
||||
return z
|
||||
.object({
|
||||
url: z.string({
|
||||
error: `Please provide the variable NEXT_PUBLIC_SUPABASE_URL`,
|
||||
description: `This is the URL of your hosted Supabase instance. Please provide the variable NEXT_PUBLIC_SUPABASE_URL.`,
|
||||
required_error: `Please provide the variable NEXT_PUBLIC_SUPABASE_URL`,
|
||||
}),
|
||||
publicKey: z.string({
|
||||
error: `Please provide the variable NEXT_PUBLIC_SUPABASE_PUBLIC_KEY`,
|
||||
description: `This is the public key provided by Supabase. It is a public key used client-side. Please provide the variable NEXT_PUBLIC_SUPABASE_PUBLIC_KEY.`,
|
||||
required_error: `Please provide the variable NEXT_PUBLIC_SUPABASE_PUBLIC_KEY`,
|
||||
}),
|
||||
})
|
||||
.parse({
|
||||
url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||
publicKey: process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_KEY,
|
||||
publicKey:
|
||||
process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_KEY ||
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export function useSignInWithEmailPassword() {
|
||||
const response = await client.auth.signInWithPassword(credentials);
|
||||
|
||||
if (response.error) {
|
||||
throw response.error;
|
||||
throw response.error.message;
|
||||
}
|
||||
|
||||
const user = response.data?.user;
|
||||
|
||||
@@ -12,7 +12,7 @@ export function useSignInWithProvider() {
|
||||
const response = await client.auth.signInWithOAuth(credentials);
|
||||
|
||||
if (response.error) {
|
||||
throw response.error;
|
||||
throw response.error.message;
|
||||
}
|
||||
|
||||
return response.data;
|
||||
|
||||
@@ -49,7 +49,7 @@ export function useSignUpWithEmailAndPassword() {
|
||||
throw new WeakPasswordError(errorObj.reasons ?? []);
|
||||
}
|
||||
|
||||
throw response.error;
|
||||
throw response.error.message;
|
||||
}
|
||||
|
||||
const user = response.data?.user;
|
||||
|
||||
Reference in New Issue
Block a user