Added Document Managment feature #388
@ -44,10 +44,14 @@ import MainRegisterPage from "../pages/authentication/MainRegisterPage";
|
|||||||
import MainForgetPage from "../pages/authentication/MainForgetPage";
|
import MainForgetPage from "../pages/authentication/MainForgetPage";
|
||||||
import MainResetPasswordPage from "../pages/authentication/MainResetPasswordPage";
|
import MainResetPasswordPage from "../pages/authentication/MainResetPasswordPage";
|
||||||
import TenantPage from "../pages/Tenant/TenantPage";
|
import TenantPage from "../pages/Tenant/TenantPage";
|
||||||
|
import { Navigate } from "react-router-dom";
|
||||||
|
import RootRedirect from "./RootRedirect";
|
||||||
const router = createBrowserRouter(
|
const router = createBrowserRouter(
|
||||||
[
|
[
|
||||||
// { path: "/", element: <LandingPage /> },
|
{
|
||||||
|
path: "/",
|
||||||
|
element: <RootRedirect />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
element: <AuthLayout />,
|
element: <AuthLayout />,
|
||||||
children: [
|
children: [
|
||||||
@ -73,8 +77,6 @@ const router = createBrowserRouter(
|
|||||||
{ path: "/project/manage/:projectId", element: <ManageProject /> },
|
{ path: "/project/manage/:projectId", element: <ManageProject /> },
|
||||||
{ path: "/employees", element: <EmployeeList /> },
|
{ path: "/employees", element: <EmployeeList /> },
|
||||||
{ path: "/employee/:employeeId", element: <EmployeeProfile /> },
|
{ path: "/employee/:employeeId", element: <EmployeeProfile /> },
|
||||||
// { path: "/employee/manage", element: <ManageEmp /> },
|
|
||||||
// {path: "/employee/manage/:employeeId", element: <ManageEmp />},
|
|
||||||
{ path: "/directory", element: <Directory /> },
|
{ path: "/directory", element: <Directory /> },
|
||||||
{ path: "/inventory", element: <Inventory /> },
|
{ path: "/inventory", element: <Inventory /> },
|
||||||
{ path: "/activities/attendance", element: <AttendancePage /> },
|
{ path: "/activities/attendance", element: <AttendancePage /> },
|
||||||
|
13
src/router/RootRedirect.jsx
Normal file
13
src/router/RootRedirect.jsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { Navigate } from "react-router-dom";
|
||||||
|
|
||||||
|
const RootRedirect = () => {
|
||||||
|
const isAuthenticated = !!localStorage.getItem("jwtToken");
|
||||||
|
return isAuthenticated ? (
|
||||||
|
<Navigate to="/dashboard" replace />
|
||||||
|
) : (
|
||||||
|
<Navigate to="/auth/login" replace />
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default RootRedirect;
|
Loading…
x
Reference in New Issue
Block a user