courrier multi account restore compose
This commit is contained in:
parent
426c9d62ee
commit
2657246c80
@ -223,7 +223,12 @@ export default function CourrierPage() {
|
||||
if (!isMounted) return;
|
||||
|
||||
// Call the session API to check email credentials and start prefetching
|
||||
const response = await fetch('/api/courrier/session');
|
||||
const response = await fetch('/api/courrier/session', {
|
||||
credentials: 'include', // Ensure cookies are sent
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
});
|
||||
|
||||
// Handle 401 Unauthorized with retry logic
|
||||
if (response.status === 401) {
|
||||
@ -234,7 +239,9 @@ export default function CourrierPage() {
|
||||
return initSession();
|
||||
} else {
|
||||
console.error('Max retries reached for session request');
|
||||
throw new Error('Failed to authenticate session after multiple attempts');
|
||||
// Instead of throwing, redirect to login
|
||||
router.push('/courrier/login');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user