middleware fix wip
This commit is contained in:
@@ -227,8 +227,11 @@ export function handleAuthFlow(
|
||||
return { shouldRedirect: false, shouldShowPage: true };
|
||||
|
||||
case AuthActionType.SHOW_PERMISSION_ERROR:
|
||||
const errorUrl = router.getLoginRedirectUrl();
|
||||
logger.info('[handleAuthFlow] Returning SHOW_PERMISSION_ERROR', { errorUrl });
|
||||
return { shouldRedirect: true, redirectUrl: errorUrl };
|
||||
// Redirect to user's home page instead of login (they're already logged in)
|
||||
const homeUrl = session?.role === 'sponsor' ? routes.sponsor.dashboard :
|
||||
session?.role === 'admin' ? routes.admin.root :
|
||||
routes.protected.dashboard;
|
||||
logger.info('[handleAuthFlow] Returning SHOW_PERMISSION_ERROR, redirecting to home', { homeUrl, userRole: session?.role });
|
||||
return { shouldRedirect: true, redirectUrl: homeUrl };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user