({ children }: { children: React.ReactNode })
| 27 | import { useAppContext } from './hooks/useAppContext'; |
| 28 | |
| 29 | function RequireAuth({ children }: { children: React.ReactNode }) { |
| 30 | const location = useLocation(); |
| 31 | |
| 32 | const { isLoggedIn } = useAppContext(); |
| 33 | |
| 34 | return isLoggedIn ? ( |
| 35 | children |
| 36 | ) : ( |
| 37 | <Navigate replace state={{ from: location }} to="/login" /> |
| 38 | ); |
| 39 | } |
| 40 | |
| 41 | export const App = () => { |
| 42 | return ( |
nothing calls this directly
no test coverage detected