fix: safe logout when firebase is not initialized

This commit is contained in:
2026-04-28 14:59:22 +05:00
parent fad9cacd3e
commit 3965b7891f
+9 -4
View File
@@ -42,10 +42,15 @@ export const useAuth = () => {
} }
const logout = async () => { const logout = async () => {
const auth = getAuth() try {
await signOut(auth) const auth = getAuth()
token.value = null await signOut(auth)
navigateTo('/login') } catch (e) {
console.warn('[Firebase] Sign out failed or not initialized', e)
} finally {
token.value = null
navigateTo('/login')
}
} }
const initAuth = () => { const initAuth = () => {