Uitloggen met uitgeschakeld CMS hing de app: de AppLayout-redirect naar /dashboard gold ook voor een gast (eindeloze navigatielus); alleen voor een ingelogde gebruiker
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,11 +22,15 @@ export function AppLayout() {
|
||||
}, [status, navigate]);
|
||||
|
||||
useEffect(() => {
|
||||
// Only for a signed-in user. A guest (just signed out) must be left alone: sending a guest to /dashboard
|
||||
// makes the authenticated route redirect straight back to /login, and with the CMS switched off this
|
||||
// effect then fires again - an endless navigation loop that froze the app after logout.
|
||||
if (status !== 'authenticated') return;
|
||||
if (availability?.status === 'NotAvailable') {
|
||||
const allowed = ALLOWED_WHEN_UNAVAILABLE.some(p => location.pathname.startsWith(p));
|
||||
if (!allowed) void navigate({ to: '/dashboard' });
|
||||
}
|
||||
}, [availability?.status, location.pathname, navigate]);
|
||||
}, [status, availability?.status, location.pathname, navigate]);
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user