From 3965b7891f5857444735d410af99cc10fb162168 Mon Sep 17 00:00:00 2001 From: AlexIves16 Date: Tue, 28 Apr 2026 14:59:22 +0500 Subject: [PATCH] fix: safe logout when firebase is not initialized --- app/composables/useAuth.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/composables/useAuth.ts b/app/composables/useAuth.ts index abfaa47..b58e2b2 100644 --- a/app/composables/useAuth.ts +++ b/app/composables/useAuth.ts @@ -42,10 +42,15 @@ export const useAuth = () => { } const logout = async () => { - const auth = getAuth() - await signOut(auth) - token.value = null - navigateTo('/login') + 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 = () => {