import React from "react"; import { Navigate } from "react-router-dom"; import { useAuth } from "../contexts/AuthContext"; const ProtectedRoute = ({ children, requireAdmin = false, requirePermission = null, }) => { const { isAuthenticated, isAdmin, isLoading, hasPermission } = useAuth(); if (isLoading) { return (
You don't have permission to access this page.
You don't have permission to access this page.