go-guess/frontend/src/app/App.tsx

32 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Route, Routes, useLocation } from 'react-router-dom'
import { useAuthSession } from '../components/actions'
import { NotFound } from '../components/ui/NotFound'
import { ParticipantInterviewPage } from '../features/assessments'
import { ParticipantMeetingPage } from '../features/interviews'
import { LoginPage } from '../features/login/LoginPage'
import { AuthenticatedApp } from './AuthenticatedApp'
import { DataProvider } from './DataContext'
2026-09-19 20:31:14 +02:00
export default function App() {
const location = useLocation()
const { authenticated, sessionExpired, completeLogin, logout } = useAuthSession()
2026-09-19 20:31:14 +02:00
2026-09-19 20:56:27 +02:00
if (location.pathname.startsWith('/participant/')) {
2026-09-19 20:31:14 +02:00
return (
<Routes>
<Route path="/participant/meeting/:token" element={<ParticipantMeetingPage />} />
2026-09-19 20:56:27 +02:00
<Route path="/participant/:invitationId" element={<ParticipantInterviewPage />} />
2026-09-19 20:31:14 +02:00
<Route path="*" element={<NotFound />} />
</Routes>
)
}
if (!authenticated) {
return <LoginPage onLogin={completeLogin} sessionExpired={sessionExpired} />
}
2026-09-19 20:31:14 +02:00
return (
<DataProvider>
<AuthenticatedApp onLogout={logout} />
2026-09-19 20:31:14 +02:00
</DataProvider>
)
}