Commit bacfa0a9 authored by TokaKaram's avatar TokaKaram

change mports

parent 0fd4d6c7
......@@ -5,6 +5,7 @@ import Loading from '../Common/Loading';
export default function ProtectedRoute({ children, adminOnly = false }) {
const { user, loading } = useAuth();
if (loading) return <Loading />;
if (!user) return <Navigate to="/login" />;
if (adminOnly && user.role !== 'admin') return <Navigate to="/" />;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment