GeneIT/geneit_app/src/App.tsx

40 lines
1.2 KiB
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-09 09:19:40 +00:00
import { BaseAuthenticatedPage } from "./widgets/BaseAuthenticatedPage";
2023-06-09 16:55:36 +00:00
import { PasswordForgottenRoute } from "./routes/auth/PasswordForgottenRoute";
2023-06-12 14:25:38 +00:00
import { ResetPasswordRoute } from "./routes/auth/ResetPasswordRoute";
2023-06-06 08:52:50 +00:00
2023-06-09 16:55:36 +00:00
/**
* Core app
*/
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-09 09:19:40 +00:00
<Route path="*" element={<BaseAuthenticatedPage />} />
2023-06-06 14:39:47 +00:00
) : (
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-09 16:55:36 +00:00
<Route
path="password_forgotten"
element={<PasswordForgottenRoute />}
/>
2023-06-12 14:25:38 +00:00
<Route path="reset_password" element={<ResetPasswordRoute />} />
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;