aboutsummaryrefslogtreecommitdiffstats
path: root/panel/src/components/PrivateRoute.jsx
blob: e2c502d65029c9a61c59d9af335e6e1e600a234a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import React from 'react';
import { Navigate, Outlet } from 'react-router-dom';
import { useAuth } from '../contexts/AuthContext';

const PrivateRoute = () => {
  const { currentUser } = useAuth();

  return currentUser ? <Outlet /> : <Navigate to="/login" />;
};

export default PrivateRoute;