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

31 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-10-01 09:06:58 +02:00
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() {
2026-10-01 09:06:58 +02:00
const location = useLocation();
const {authenticated, sessionExpired, completeLogin, logout} = useAuthSession();
if (location.pathname.startsWith('/participant/')) {
return (
<Routes>
<Route path="/participant/meeting/:token" element={<ParticipantMeetingPage/>}/>
<Route path="/participant/:invitationId" element={<ParticipantInterviewPage/>}/>
<Route path="*" element={<NotFound/>}/>
</Routes>
)
}
if (!authenticated) {
return <LoginPage onLogin={completeLogin} sessionExpired={sessionExpired}/>
}
2026-09-19 20:31:14 +02:00
return (
2026-10-01 09:06:58 +02:00
<DataProvider>
<AuthenticatedApp onLogout={logout}/>
</DataProvider>
2026-09-19 20:31:14 +02:00
)
}