2026-05-26 15:48:01 +05:30
|
|
|
import { Navigate, Outlet } from 'react-router-dom';
|
|
|
|
|
import { useAuth } from '@/context/AuthContext';
|
2026-03-16 17:55:33 +05:30
|
|
|
|
|
|
|
|
export default function ProtectedRoute() {
|
2026-05-26 15:48:01 +05:30
|
|
|
const { token } = useAuth();
|
2026-03-16 17:55:33 +05:30
|
|
|
return token ? <Outlet /> : <Navigate to="/" replace />;
|
|
|
|
|
}
|