feat: Implement authentication checks for profile actions and user layout, and add presigned URL fetching for file viewing.

This commit is contained in:
pradeepkumar
2026-01-29 00:02:59 +05:30
parent 4ffd6305b1
commit b41bd8a3eb
9 changed files with 243 additions and 40 deletions

View File

@@ -11,17 +11,16 @@ export default function Home() {
useEffect(() => {
if (status === 'loading') return;
if (!session) {
router.replace('/login');
return;
}
// Redirect based on user role
const userRole = (session.user as any)?.role;
if (userRole === 'AGENT') {
router.replace('/agent/dashboard');
// Redirect based on user role, or to public dashboard if not logged in
if (session) {
const userRole = (session.user as any)?.role;
if (userRole === 'AGENT') {
router.replace('/agent/dashboard');
} else {
router.replace('/user/dashboard');
}
} else {
// Not logged in - go to public user dashboard
router.replace('/user/dashboard');
}
}, [session, status, router]);