diff --git a/src/App.tsx b/src/App.tsx
index b70a8a51..6a941a87 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -38,13 +38,7 @@ const App = () => {
- {isUsingOidcAuth() ? (
-
-
-
- ) : (
-
- )}
+
diff --git a/src/components/routes/AppRoutes.tsx b/src/components/routes/AppRoutes.tsx
index 67ea92cd..ac949e2e 100644
--- a/src/components/routes/AppRoutes.tsx
+++ b/src/components/routes/AppRoutes.tsx
@@ -1,9 +1,7 @@
import * as React from "react";
import Login from "@components/login/Login";
-import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";
+import { BrowserRouter, Route, Routes } from "react-router-dom";
import Logout from "@components/Logout";
-import PublicRoute from "@components/routes/PublicRoute";
-import PrivateRoute from "@components/routes/PrivateRoute";
import Register from "@components/register/Register";
import { createHashHistory } from "history";
import { LoggedUserProvider } from "@hooks/useLoggedUser";
@@ -12,7 +10,6 @@ import FaultTreeDashboard from "@components/dashboard/FaultTreeDashboard";
import SystemDashboard from "@components/dashboard/SystemDashboard";
import FailureModesTableDashboard from "@components/dashboard/FailureModesTableDashboard";
import AdminDashboard from "@components/dashboard/AdminDashboard";
-import AdminRoute from "@components/routes/AdminRoute";
import Navigation from "../navigation/Navigation";
import SystemsOverview from "../systems/SystemsOverview";
import FtaOverview from "../fta/FtaOverview";
@@ -20,127 +17,99 @@ import FmeaOverview from "../fmea/FmeaOverview";
import FhaOverview from "../fha/FhaOverview";
import OidcSignInCallback from "@oidc/OidcSignInCallback";
import OidcSilentCallback from "@oidc/OidcSilentCallback";
+import { isUsingOidcAuth } from "@utils/OidcUtils";
+import OidcAuthWrapper from "@oidc/OidcAuthWrapper";
+import PublicRoute from "@components/routes/PublicRoute";
+import PrivateRoute from "@components/routes/PrivateRoute";
+import AdminRoute from "@components/routes/AdminRoute";
export const appHistory = createHashHistory();
const AppRoutes = () => {
+ const routes = [
+ {
+ path: ROUTES.REGISTER,
+ element: ,
+ },
+ {
+ path: ROUTES.LOGIN,
+ element: ,
+ },
+ { path: ROUTES.ADMINISTRATION, element: },
+ {
+ path: ROUTES.LOGOUT,
+ element: ,
+ },
+ {
+ path: ROUTES.SYSTEMS,
+ element: ,
+ },
+ {
+ path: ROUTES.SYSTEMS + ROUTE_PARAMS.SYSTEM_FRAGMENT,
+ element: ,
+ },
+ {
+ path: ROUTES.FTA,
+ element: ,
+ },
+ {
+ path: ROUTES.FTA + ROUTE_PARAMS.FTA_FRAGMENT,
+ element: ,
+ },
+ {
+ path: ROUTES.FMEA,
+ element: ,
+ },
+ {
+ path: ROUTES.FMEA + ROUTE_PARAMS.FMEA_FRAGMENT,
+ element: ,
+ },
+ {
+ path: ROUTES.FHA,
+ element: ,
+ },
+ {
+ path: "/*",
+ element: ,
+ },
+ ];
+
+ const getElement = (path, element) => {
+ switch (path) {
+ case ROUTES.LOGIN:
+ return {element};
+ case ROUTES.ADMINISTRATION:
+ return {element};
+ case ROUTES.REGISTER:
+ return ENVVariable.ADMIN_REGISTRATION_ONLY === "true" ? (
+
+
+
+ ) : (
+
+
+
+ );
+ default:
+ return {element};
+ }
+ };
+
return (
- {/*TODO: revisit routing, this is hotfix to support react-router v6*/}
- {ENVVariable.ADMIN_REGISTRATION_ONLY === "true" ? (
-
-
-
- }
- />
- ) : (
-
-
-
- }
- />
- )}
-
-
-
- }
- />
-
-
-
- }
- />
-
-
-
-
- }
- />
-
-
-
- }
- />
-
-
-
-
- }
- />
-
-
-
-
- }
- />
-
-
-
-
- }
- />
-
-
-
-
- }
- />
-
-
-
-
- }
- />
-
-
-
-
- }
- />
-
} />
} />
- } />
+ {routes.map((r) => {
+ if (isUsingOidcAuth()) {
+ return {r.element}} />;
+ } else {
+ return ;
+ }
+ })}