fix: auto-redirect super admins to the super admin panel from root
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m45s

- Updated AuthGuard to intercept navigation to the standard dashboard ('/') for users with the 'super_admin' role and automatically redirect them to '/super-admin'.
This commit is contained in:
Cauê Faleiros
2026-03-18 09:32:21 -03:00
parent 22a1228a60
commit 47799990e3

View File

@@ -76,6 +76,11 @@ const AuthGuard: React.FC<{ children: React.ReactNode, roles?: string[] }> = ({
return <Navigate to="/" replace />; return <Navigate to="/" replace />;
} }
// Auto-redirect Super Admins away from the standard dashboard to their specific panel
if (location.pathname === '/' && user.role === 'super_admin') {
return <Navigate to="/super-admin" replace />;
}
return <Layout>{children}</Layout>; return <Layout>{children}</Layout>;
}; };