fix(auth): removed auto logout

This commit is contained in:
gabdevele
2026-06-15 11:47:40 +02:00 Unverified
parent b120b6f989
commit 48f0f65dc1
3 changed files with 18 additions and 18 deletions
+9
View File
@@ -24,6 +24,10 @@ export const useAuth = () => {
const user = useState<UserContext | null>('auth_user', () => null)
const isSyncingUser = useState<boolean>('auth_syncing', () => false)
const isAuthenticated = computed(() => !!(tokenState.value || token.value))
const isAuthStatusError = (error: any) => {
const status = error?.statusCode || error?.status || error?.response?.status
return status === 401 || status === 403
}
watch(() => token.value, (newVal) => {
tokenState.value = newVal || null
@@ -46,6 +50,11 @@ export const useAuth = () => {
}
}
} catch (error) {
if (isAuthStatusError(error)) {
console.error('[Auth] Sync failed with authentication error, keeping session state:', error)
return
}
console.error('[Auth] Sync failed, logging out:', error)
logout()
} finally {