fix auth refresh endpoint and quiet expected 401 on profile check
This commit is contained in:
@@ -107,8 +107,16 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
setCurrentOrganization(null);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Auth check failed:', err);
|
||||
} catch (err: unknown) {
|
||||
const status =
|
||||
(err as { statusCode?: number })?.statusCode ??
|
||||
(err as { response?: { status?: number } })?.response?.status;
|
||||
|
||||
// 401 on profile is expected when there is no session — not an application error.
|
||||
if (status !== 401) {
|
||||
console.error('Auth check failed:', err);
|
||||
}
|
||||
|
||||
// Only clear state — DO NOT redirect here
|
||||
setUser(null);
|
||||
setOrganizations([]);
|
||||
|
||||
Reference in New Issue
Block a user