fix(frontend): handle network errors gracefully in auth refresh

This commit is contained in:
GoHorse Deploy 2026-02-09 11:31:30 +00:00
parent e1638f9275
commit 65ac4233c2

View file

@ -158,7 +158,14 @@ export async function refreshSession(): Promise<User | null> {
console.log("%c[AUTH] Session restored from cookie", "color: #10b981", user.email);
return user;
} catch (error) {
// Only log for non-network errors in development
// "Failed to fetch" is expected when API is unreachable (normal for unauthenticated users)
if (error instanceof TypeError && error.message.includes('Failed to fetch')) {
// Silent fail for network errors - this is expected
console.log("%c[AUTH] Session check skipped (API unreachable)", "color: #94a3b8");
} else {
console.error("%c[AUTH] Failed to refresh session:", "color: #ef4444", error);
}
return null;
}
}