main layout

This commit is contained in:
pradeepkumar
2026-01-11 22:09:41 +05:30
parent 500c8b6e5d
commit 0c7239d7a8
22 changed files with 1847 additions and 369 deletions

View File

@@ -28,11 +28,8 @@ export default auth((req) => {
// Redirect logged-in users away from public routes (login, signup)
if (isLoggedIn && isPublicRoute) {
// Redirect to appropriate dashboard based on role
if (userRole === "AGENT") {
return NextResponse.redirect(new URL("/agent/dashboard", nextUrl.origin));
}
return NextResponse.redirect(new URL("/user/dashboard", nextUrl.origin));
// Redirect to home page instead of dashboard
return NextResponse.redirect(new URL("/", nextUrl.origin));
}
// Redirect non-logged-in users to login page for protected routes
@@ -46,7 +43,7 @@ export default auth((req) => {
if (isLoggedIn) {
// Prevent regular users from accessing agent routes
if (isAgentRoute && userRole !== "AGENT") {
return NextResponse.redirect(new URL("/user/dashboard", nextUrl.origin));
return NextResponse.redirect(new URL("/user/userprofile", nextUrl.origin));
}
// Prevent agents from accessing user routes