feat: Integrate Data Connect and Implement Staff List View Directory

This commit is contained in:
dhinesh-m24
2026-01-31 16:54:59 +05:30
parent 48bb1c457c
commit cb25b33d04
255 changed files with 21425 additions and 109 deletions

View File

@@ -5,7 +5,7 @@ import type { RootState } from '../../store/store';
interface ProtectedRouteProps {
children: React.ReactNode;
allowedRoles: Array<'admin' | 'client' | 'vendor'>;
allowedRoles: Array<'admin' | 'client' | 'vendor' | 'ADMIN' | 'CLIENT' | 'VENDOR'>;
redirectTo?: string;
}
@@ -27,7 +27,11 @@ const ProtectedRoute: React.FC<ProtectedRouteProps> = ({
}
// If user is authenticated but role is not allowed, redirect to specified path
if (user?.userRole && !allowedRoles.includes(user.userRole)) {
// Compare roles case-insensitively to handle backend casing (e.g., "ADMIN" vs "admin")
if (
user?.userRole &&
!allowedRoles.some((r) => r.toLowerCase() === user.userRole!.toLowerCase())
) {
return <Navigate to={redirectTo} replace />;
}