fix: safe logout when firebase is not initialized
This commit is contained in:
@@ -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 = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user