fix: safe logout when firebase is not initialized
This commit is contained in:
@@ -42,11 +42,16 @@ export const useAuth = () => {
|
||||
}
|
||||
|
||||
const logout = async () => {
|
||||
try {
|
||||
const auth = getAuth()
|
||||
await signOut(auth)
|
||||
} catch (e) {
|
||||
console.warn('[Firebase] Sign out failed or not initialized', e)
|
||||
} finally {
|
||||
token.value = null
|
||||
navigateTo('/login')
|
||||
}
|
||||
}
|
||||
|
||||
const initAuth = () => {
|
||||
const auth = getAuth()
|
||||
|
||||
Reference in New Issue
Block a user