fix(frontend): handle network errors gracefully in auth refresh
This commit is contained in:
parent
e1638f9275
commit
65ac4233c2
1 changed files with 11 additions and 4 deletions
|
|
@ -158,7 +158,14 @@ export async function refreshSession(): Promise<User | null> {
|
||||||
console.log("%c[AUTH] Session restored from cookie", "color: #10b981", user.email);
|
console.log("%c[AUTH] Session restored from cookie", "color: #10b981", user.email);
|
||||||
return user;
|
return user;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("%c[AUTH] Failed to refresh session:", "color: #ef4444", 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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue