Files
headquarter/apps/web/src/components/RouteGuard.tsx
T
alex 6f18dd24a5 feat(FN-005): implement frontend foundation with auth and routing
- Add OIDC authentication with PKCE flow
- Create dashboard shell with sidebar and header
- Implement project management UI (list, create, detail)
- Add tool spawn page with tool/project selection
- Create tool instance detail page with status and controls
- Set up React Router with route guards
- Add Zustand auth store and API client with types
2026-05-14 17:28:15 +02:00

21 lines
570 B
TypeScript

import { Navigate } from 'react-router-dom'
import { useAuthStore } from '../stores/auth'
export default function RouteGuard({ children }: { children: React.ReactNode }) {
const { state } = useAuthStore()
if (state === 'loading') {
return (
<div className="flex min-h-screen items-center justify-center">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-accent"></div>
</div>
)
}
if (state === 'unauthenticated' || state === 'error') {
return <Navigate to="/login" replace />
}
return <>{children}</>
}