diff --git a/src/router/AppRoutes.jsx b/src/router/AppRoutes.jsx index ecb3622b..6fec430a 100644 --- a/src/router/AppRoutes.jsx +++ b/src/router/AppRoutes.jsx @@ -44,10 +44,14 @@ import MainRegisterPage from "../pages/authentication/MainRegisterPage"; import MainForgetPage from "../pages/authentication/MainForgetPage"; import MainResetPasswordPage from "../pages/authentication/MainResetPasswordPage"; import TenantPage from "../pages/Tenant/TenantPage"; - +import { Navigate } from "react-router-dom"; +import RootRedirect from "./RootRedirect"; const router = createBrowserRouter( [ - // { path: "/", element: }, + { + path: "/", + element: , + }, { element: , children: [ @@ -73,8 +77,6 @@ const router = createBrowserRouter( { path: "/project/manage/:projectId", element: }, { path: "/employees", element: }, { path: "/employee/:employeeId", element: }, - // { path: "/employee/manage", element: }, - // {path: "/employee/manage/:employeeId", element: }, { path: "/directory", element: }, { path: "/inventory", element: }, { path: "/activities/attendance", element: }, diff --git a/src/router/RootRedirect.jsx b/src/router/RootRedirect.jsx new file mode 100644 index 00000000..d00f99fe --- /dev/null +++ b/src/router/RootRedirect.jsx @@ -0,0 +1,13 @@ +import React from "react"; +import { Navigate } from "react-router-dom"; + +const RootRedirect = () => { + const isAuthenticated = !!localStorage.getItem("jwtToken"); + return isAuthenticated ? ( + + ) : ( + + ); +}; + +export default RootRedirect; diff --git a/src/utils/constants.jsx b/src/utils/constants.jsx index 18db82df..ab66b2c1 100644 --- a/src/utils/constants.jsx +++ b/src/utils/constants.jsx @@ -1,7 +1,7 @@ export const THRESH_HOLD = 48; // hours export const DURATION_TIME = 10; // minutes export const ITEMS_PER_PAGE = 20; -export const OTP_EXPIRY_SECONDS = 600 // OTP time +export const OTP_EXPIRY_SECONDS = 300 // OTP time export const MANAGE_MASTER = "588a8824-f924-4955-82d8-fc51956cf323";