refactor: remove agent redirect from user dashboard layout to allow persistent access

This commit is contained in:
pradeepkumar
2026-05-11 14:04:37 +05:30
parent eb1755c22d
commit 868e50c41d

View File

@@ -34,15 +34,10 @@ export default function UserLayout({
useEffect(() => {
if (status === 'loading') return;
// Allow public pages without authentication
// Allow public pages without authentication.
// Agents are intentionally allowed to land on /user/dashboard — the logo
// points there for all roles, so this layout must not bounce them away.
if (isPublic) {
// If logged in as agent, redirect to agent dashboard only from user dashboard
if (session && pathname === '/user/dashboard') {
const userRole = (session.user as any)?.role;
if (userRole === 'AGENT') {
router.replace('/agent/dashboard');
}
}
return;
}