Download frontend/src/components/ProtectedRoute.jsx from MoBkr/dosemate: direct link, hf CLI and curl.
- Browser
- Download file 501 Bytes
-
https://huggingface.co/spaces/MoBkr/dosemate/resolve/main/frontend/src/components/ProtectedRoute.jsx
- Command line
-
hf download hf://spaces/MoBkr/dosemate/frontend/src/components/ProtectedRoute.jsx
-
curl -L -o ProtectedRoute.jsx https://huggingface.co/spaces/MoBkr/dosemate/resolve/main/frontend/src/components/ProtectedRoute.jsx
501 Bytes
| import { Navigate, Outlet } from "react-router-dom" | |
| import { useAuth } from "../auth/AuthContext" | |
| export default function ProtectedRoute() { | |
| const { isAuthenticated, loading } = useAuth() | |
| if (loading) { | |
| return ( | |
| <div style={{ | |
| width: "100%", height: "100vh", display: "flex", | |
| alignItems: "center", justifyContent: "center", color: "#64748b", | |
| }}> | |
| Loading… | |
| </div> | |
| ) | |
| } | |
| return isAuthenticated ? <Outlet /> : <Navigate to="/login" replace /> | |
| } | |