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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user