feat: integrate hospital management module with advanced UI styling and analytics components
This commit is contained in:
@@ -21,6 +21,7 @@ import { FleetLogin } from './pages/FleetLogin';
|
||||
import { FleetOperatorDashboard } from './pages/FleetOperatorDashboard';
|
||||
import { PerspectiveLauncher } from './pages/PerspectiveLauncher';
|
||||
import { RoleLogin } from './pages/RoleLogin';
|
||||
import { HospitalLogin } from './pages/HospitalLogin';
|
||||
import { ComingSoonPortal } from './pages/ComingSoonPortal';
|
||||
import {
|
||||
Building2,
|
||||
@@ -43,10 +44,13 @@ const RoleProtectedRoute: React.FC<{
|
||||
|
||||
if (!isAuthenticated) return <Navigate to="/login" replace />;
|
||||
|
||||
const userRoles = Array.isArray(user?.roles) ? user.roles : [];
|
||||
const userRoles = Array.isArray(user?.roles)
|
||||
? user.roles.map((r: any) => String(r).toUpperCase().replace(/\s+/g, '_'))
|
||||
: [];
|
||||
const hasAccess = allowedRoles.some(role => userRoles.includes(role)) || userRoles.includes('CURESELECT_ADMIN');
|
||||
|
||||
if (!hasAccess) {
|
||||
console.log('[RBAC] Access Denied:', { required: allowedRoles, current: userRoles });
|
||||
// Redirect to their respective "home" if they don't have access
|
||||
if (userRoles.includes('FLEET_OPERATOR')) return <Navigate to="/fleet-operator" replace />;
|
||||
return <Navigate to="/" replace />;
|
||||
@@ -121,6 +125,7 @@ function AppContent() {
|
||||
<Routes>
|
||||
<Route path="/" element={<PerspectiveLauncher />} />
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route path="/login/hospital" element={<HospitalLogin />} />
|
||||
<Route path="/login/:role" element={<RoleLogin />} />
|
||||
<Route path="/fleet-login" element={<FleetLogin />} />
|
||||
<Route path="/launcher" element={<PerspectiveLauncher />} />
|
||||
|
||||
Reference in New Issue
Block a user