feat: initial commit
This commit is contained in:
13
src/components/RoleRedirect.jsx
Normal file
13
src/components/RoleRedirect.jsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Navigate } from 'react-router-dom';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
|
||||
export default function RoleRedirect() {
|
||||
const { role, loading } = useAuth();
|
||||
|
||||
if (loading) return null;
|
||||
|
||||
if (role === 'admin') return <Navigate to="/admin" replace />;
|
||||
if (role === 'firmenleiter') return <Navigate to="/firmenleiter" replace />;
|
||||
if (role === 'filialleiter') return <Navigate to="/filialleiter" replace />;
|
||||
return <Navigate to="/tracker" replace />;
|
||||
}
|
||||
Reference in New Issue
Block a user