Spaces:
Sleeping
Sleeping
| import React from "react"; | |
| import { Navigate, Outlet } from "react-router-dom"; | |
| import { useAuth } from "@/lib/auth-context"; | |
| const PrivateRoute = () => { | |
| const { isAuthenticated } = useAuth(); | |
| if (!isAuthenticated) { | |
| return <Navigate to="/login" replace />; | |
| } | |
| return <Outlet />; | |
| }; | |
| export default PrivateRoute; |