GeneIT/geneit_app/src/App.tsx

29 lines
835 B
TypeScript
Raw Normal View History

2023-06-06 14:39:47 +00:00
import { Route, Routes } from "react-router-dom";
import "./App.css";
import { AuthApi } from "./api/AuthApi";
import { NotFoundRoute } from "./routes/NotFound";
2023-06-06 14:50:47 +00:00
import { BaseLoginPage } from "./widgets/BaseLoginpage";
2023-06-09 08:45:01 +00:00
import { LoginRoute } from "./routes/auth/LoginRoute";
import { OIDCCbRoute } from "./routes/auth/OIDCCbRoute";
import { useAtom } from "jotai";
2023-06-06 08:52:50 +00:00
function App() {
2023-06-09 08:45:01 +00:00
const [signedIn] = useAtom(AuthApi.authStatus);
2023-06-06 08:52:50 +00:00
return (
2023-06-06 14:39:47 +00:00
<Routes>
2023-06-09 08:45:01 +00:00
{signedIn ? (
2023-06-06 14:39:47 +00:00
<Route path="*" element={<p>signed in</p>} />
) : (
2023-06-06 14:50:47 +00:00
<Route path="*" element={<BaseLoginPage />}>
2023-06-09 08:45:01 +00:00
<Route path="" element={<LoginRoute />} />
<Route path="oidc_cb" element={<OIDCCbRoute />} />
2023-06-06 14:50:47 +00:00
<Route path="*" element={<NotFoundRoute />} />
</Route>
2023-06-06 14:39:47 +00:00
)}
</Routes>
2023-06-06 08:52:50 +00:00
);
}
export default App;