Fix toast and sync settings

- Fix issue where toast notifications were not disappearing.
- Ensure sync settings are turned off upon logout.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 10:37:26 +00:00
parent dab1a9cb84
commit 14c3fac824
6 changed files with 63 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ import { Session, User } from '@supabase/supabase-js';
import { toast } from '@/hooks/useToast.wrapper';
import { AuthContextType } from './types';
import * as authActions from './authActions';
import { clearAllToasts } from '@/hooks/toast/toastManager';
const AuthContext = createContext<AuthContextType | undefined>(undefined);
@@ -45,6 +46,12 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
} else if (event === 'SIGNED_OUT') {
setSession(null);
setUser(null);
// 로그아웃 시 열려있는 모든 토스트 제거
clearAllToasts();
// 로그아웃 이벤트 발생시켜 SyncSettings 등에서 감지하도록 함
window.dispatchEvent(new Event('auth-state-changed'));
}
setLoading(false);