Spaces:
Sleeping
Sleeping
Download frontend/src/components/ProtectedRoute.jsx from avborg/adventure-log: direct link, hf CLI and curl.
- Browser
- Download file 245 Bytes
-
https://huggingface.co/spaces/avborg/adventure-log/resolve/main/frontend/src/components/ProtectedRoute.jsx
- Command line
-
hf download hf://spaces/avborg/adventure-log/frontend/src/components/ProtectedRoute.jsx
-
curl -L -o ProtectedRoute.jsx https://huggingface.co/spaces/avborg/adventure-log/resolve/main/frontend/src/components/ProtectedRoute.jsx
245 Bytes
| import { Navigate } from 'react-router-dom' | |
| import { useAuth } from '../hooks/useAuth' | |
| export default function ProtectedRoute({ children }) { | |
| const { user } = useAuth() | |
| if (!user) return <Navigate to="/login" replace /> | |
| return children | |
| } | |