Download frontend/src/components/auth/RequireAuth.jsx from Seth0330/qualifier: direct link, hf CLI and curl.
- Browser
- Download file 514 Bytes
-
https://huggingface.co/spaces/Seth0330/qualifier/resolve/main/frontend/src/components/auth/RequireAuth.jsx
- Command line
-
hf download hf://spaces/Seth0330/qualifier/frontend/src/components/auth/RequireAuth.jsx
-
curl -L -o RequireAuth.jsx https://huggingface.co/spaces/Seth0330/qualifier/resolve/main/frontend/src/components/auth/RequireAuth.jsx
514 Bytes
| import React from 'react'; | |
| import { useAuth } from '@/context/AuthContext'; | |
| import SignIn from '@/pages/SignIn'; | |
| /** | |
| * Blocks the app until the user has a valid Google session. | |
| * API routes remain protected server-side; this prevents browsing the UI while signed out. | |
| */ | |
| export default function RequireAuth({ children }) { | |
| const { phase, signedIn } = useAuth(); | |
| if (phase === 'loading') { | |
| return <SignIn />; | |
| } | |
| if (!signedIn) { | |
| return <SignIn />; | |
| } | |
| return children; | |
| } | |