Update error message
Update error message when signup is not allowed.
This commit is contained in:
@@ -15,6 +15,13 @@ export const signUp = async (email: string, password: string, username: string)
|
||||
|
||||
console.log('회원가입 시도:', email);
|
||||
|
||||
// Supabase anon 키 확인
|
||||
const supabaseKey = localStorage.getItem('supabase_key');
|
||||
if (!supabaseKey || supabaseKey.includes('your-onpremise-anon-key')) {
|
||||
showAuthToast('설정 오류', 'Supabase 설정이 올바르지 않습니다. 설정 페이지에서 확인해주세요.', 'destructive');
|
||||
return { error: { message: 'Supabase 설정이 올바르지 않습니다. 설정 페이지에서 확인해주세요.' }, user: null };
|
||||
}
|
||||
|
||||
// 기본 회원가입 시도
|
||||
try {
|
||||
const { data, error } = await supabase.auth.signUp({
|
||||
@@ -41,6 +48,14 @@ export const signUp = async (email: string, password: string, username: string)
|
||||
return await signUpWithDirectApi(email, password, username);
|
||||
}
|
||||
|
||||
// 401 오류 감지 및 처리
|
||||
if (error.message.includes('401') || error.message.includes('권한이 없습니다') ||
|
||||
error.message.includes('Unauthorized') || error.status === 401) {
|
||||
const errorMessage = '회원가입 권한이 없습니다. Supabase 설정 또는 권한을 확인하세요.';
|
||||
showAuthToast('회원가입 실패', errorMessage, 'destructive');
|
||||
return { error: { message: errorMessage }, user: null, redirectToSettings: true };
|
||||
}
|
||||
|
||||
// 기타 오류 처리
|
||||
let errorMessage = error.message;
|
||||
|
||||
@@ -87,6 +102,13 @@ export const signUp = async (email: string, password: string, username: string)
|
||||
} catch (error: any) {
|
||||
console.error('기본 회원가입 프로세스 예외:', error);
|
||||
|
||||
// 401 오류 감지 및 처리
|
||||
if (error.status === 401 || (error.message && error.message.includes('401'))) {
|
||||
const errorMessage = '회원가입 권한이 없습니다. Supabase 설정 또는 권한을 확인하세요.';
|
||||
showAuthToast('회원가입 실패', errorMessage, 'destructive');
|
||||
return { error: { message: errorMessage }, user: null, redirectToSettings: true };
|
||||
}
|
||||
|
||||
// 직접 API 호출로 대체 시도
|
||||
if (error.message && (
|
||||
error.message.includes('json') ||
|
||||
|
||||
Reference in New Issue
Block a user