From 3ef81e49a077551da62b0204579daed69f05d009 Mon Sep 17 00:00:00 2001 From: khushboo-khatoon Date: Thu, 30 Jul 2026 11:27:54 +0530 Subject: [PATCH] fix: return success/error from signOut and add onError handling to auth listener --- frontend/hooks/useAuth.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/hooks/useAuth.ts b/frontend/hooks/useAuth.ts index 00f555e..35b82a2 100644 --- a/frontend/hooks/useAuth.ts +++ b/frontend/hooks/useAuth.ts @@ -13,10 +13,18 @@ export function useAuth() { return; } - const unsubscribe = onAuthStateChanged(auth, (currentUser) => { - setUser(currentUser); - setLoading(false); - }); + const unsubscribe = onAuthStateChanged( + auth, + (currentUser) => { + setUser(currentUser); + setLoading(false); + }, + (error) => { + console.error('Auth state change error:', error); + setUser(null); + setLoading(false); + } +); return () => unsubscribe(); }, []);