Spaces:
Sleeping
Sleeping
Download src/components/ProtectedRoute.jsx from Aya07/emotion-ui: direct link, hf CLI and curl.
- Browser
- Download file 483 Bytes
-
https://huggingface.co/spaces/Aya07/emotion-ui/resolve/main/src/components/ProtectedRoute.jsx
- Command line
-
hf download hf://spaces/Aya07/emotion-ui/src/components/ProtectedRoute.jsx
-
curl -L -o ProtectedRoute.jsx https://huggingface.co/spaces/Aya07/emotion-ui/resolve/main/src/components/ProtectedRoute.jsx
483 Bytes
| // src/components/ProtectedRoute.jsx | |
| import React from 'react'; | |
| import { useAuth } from '../contexts/AuthContext'; | |
| const ProtectedRoute = ({ children }) => { | |
| const { isAuthenticated, loading } = useAuth(); | |
| if (loading) { | |
| return ( | |
| <div className="loading-container"> | |
| <div className="spinner"></div> | |
| <p>Loading...</p> | |
| </div> | |
| ); | |
| } | |
| if (!isAuthenticated) { | |
| return <LoginPage />; | |
| } | |
| return children; | |
| }; | |
| export default ProtectedRoute; |