From 868e50c41d7a0010ca65a72f896d484789c116fe Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 11 May 2026 14:04:37 +0530 Subject: [PATCH] refactor: remove agent redirect from user dashboard layout to allow persistent access --- src/app/(user)/layout.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/app/(user)/layout.tsx b/src/app/(user)/layout.tsx index 8904c4d..536ecd3 100644 --- a/src/app/(user)/layout.tsx +++ b/src/app/(user)/layout.tsx @@ -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; }