Initial commit

This commit is contained in:
Samandar Turgunboyev
2025-09-09 10:46:03 +05:00
commit 1e5357ec39
53 changed files with 34753 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import { Navigate } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
const RoleProtectedRoute = ({ children, allowedRoles }) => {
const { user } = useAuth();
if (!user) return <Navigate to="/login" />;
if (!allowedRoles.includes(user.role)) return <Navigate to="/login" />;
return children;
};
export default RoleProtectedRoute;