Remove demo mode

Removes demo mode to ensure proper Supabase functionality.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 10:20:14 +00:00
parent 7b2ce776e4
commit 8e1f2de87e
3 changed files with 27 additions and 110 deletions

View File

@@ -6,31 +6,8 @@ export const signIn = async (email: string, password: string) => {
try {
console.log('로그인 시도 중:', email);
// 데모 모드: 실제 API 호출 대신 직접 성공 응답 반환
// 실제 환경에서는 이 코드를 제거하고 아래의 주석 처리된 코드를 사용하세요
toast({
title: '데모 모드 로그인',
description: '데모 모드에서는 실제 로그인이 처리되지 않습니다.',
});
const { data, error } = await supabase.auth.signInWithPassword({ email, password });
// 성공 메시지
toast({
title: '로그인 성공',
description: '환영합니다!',
});
// 가짜 사용자 세션 생성
localStorage.setItem('demo_user', JSON.stringify({
id: 'demo-user-id',
email: email,
user_metadata: { username: email.split('@')[0] },
created_at: new Date().toISOString()
}));
return { error: null };
/* 실제 Supabase 코드 - 데모 모드가 아닐 때 사용
const { error } = await supabase.auth.signInWithPassword({ email, password });
if (error) {
console.error('로그인 오류:', error);
toast({
@@ -45,8 +22,8 @@ export const signIn = async (email: string, password: string) => {
title: '로그인 성공',
description: '환영합니다!',
});
return { error: null };
*/
return { error: null, user: data.user };
} catch (error: any) {
console.error('로그인 중 예외 발생:', error);
@@ -68,32 +45,6 @@ export const signUp = async (email: string, password: string, username: string)
try {
console.log('회원가입 시도:', { email, username });
// 데모 모드에서는 회원가입 성공으로 처리합니다.
// 실제 환경에서는 이 부분을 제거하고 아래의 supabase.auth.signUp 호출을 사용하세요.
const mockUser = {
id: 'mock-user-id',
email,
user_metadata: { username },
created_at: new Date().toISOString()
};
// 데모 알림 표시
toast({
title: '데모 모드 알림',
description: '현재 데모 모드에서 실행 중입니다. 실제 계정이 생성되지 않습니다.',
});
// 성공 메시지 표시
toast({
title: '회원가입 성공',
description: '환영합니다! 이제 서비스를 이용할 수 있습니다.',
});
return { error: null, user: mockUser };
// 아래는 실제 Supabase 회원가입 코드입니다.
// 데모 모드가 아닌 경우 이 코드를 사용하세요.
/*
const { data, error } = await supabase.auth.signUp({
email,
password,
@@ -120,7 +71,6 @@ export const signUp = async (email: string, password: string, username: string)
});
return { error: null, user: data.user };
*/
} catch (error: any) {
console.error('회원가입 중 예외 발생:', error);