diff --git a/src/Components/Sidebar/Sidebar.tsx b/src/Components/Sidebar/Sidebar.tsx index 7dd700c..f95da1f 100644 --- a/src/Components/Sidebar/Sidebar.tsx +++ b/src/Components/Sidebar/Sidebar.tsx @@ -45,13 +45,15 @@ export default function Sidebar() { > - navigate("/Inventory")} name="Inventory" > + navigate("/Logs")} name="Logs"> + + diff --git a/src/Routes/Dashboard/Dashboard.tsx b/src/Routes/Dashboard/Dashboard.tsx index 55e3fcb..efbdc93 100644 --- a/src/Routes/Dashboard/Dashboard.tsx +++ b/src/Routes/Dashboard/Dashboard.tsx @@ -8,8 +8,16 @@ import styles from "../../styles"; import HomeIcon from "../../Components/Icons/HomeIcon/HomeIcon"; import ColoredCube from "../../Components/ColoredCube/ColoredCube"; import RecentlyAddedIcon from "../../Components/Icons/RecentlyAddedIcon/RecentlyAddedIcon"; +import { Navigate } from "react-router-dom"; +import { LoginState } from "../../Interfaces/Interfaces"; +import { useSelector } from "react-redux"; export default function Dashboard() { + const logged_in = useSelector((state: LoginState) => state.logged_in.value); + if (!logged_in) { + return ; + } + return (
diff --git a/src/Routes/Logs/Logs.tsx b/src/Routes/Logs/Logs.tsx index 3d601b6..ae08edc 100644 --- a/src/Routes/Logs/Logs.tsx +++ b/src/Routes/Logs/Logs.tsx @@ -10,8 +10,15 @@ import { TableRow, } from "@mui/material"; import { SampleLogData } from "../../Components/SampleData/SampleData"; +import { Navigate } from "react-router-dom"; +import { LoginState } from "../../Interfaces/Interfaces"; +import { useSelector } from "react-redux"; export default function Logs() { + const logged_in = useSelector((state: LoginState) => state.logged_in.value); + if (!logged_in) { + return ; + } return (
diff --git a/src/Routes/Product/Product.tsx b/src/Routes/Product/Product.tsx index 5db76b7..8a4f01d 100644 --- a/src/Routes/Product/Product.tsx +++ b/src/Routes/Product/Product.tsx @@ -2,9 +2,16 @@ import * as React from "react"; import styles from "../../styles"; import { Button } from "@mui/material"; import { useParams } from "react-router-dom"; +import { Navigate } from "react-router-dom"; +import { LoginState } from "../../Interfaces/Interfaces"; +import { useSelector } from "react-redux"; export default function Product() { let { id } = useParams(); + const logged_in = useSelector((state: LoginState) => state.logged_in.value); + if (!logged_in) { + return ; + } return (

diff --git a/src/Routes/Products/Products.tsx b/src/Routes/Products/Products.tsx index 7641217..bb3082e 100644 --- a/src/Routes/Products/Products.tsx +++ b/src/Routes/Products/Products.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useEffect } from "react"; import styles from "../../styles"; import { useNavigate } from "react-router-dom"; import ProductsIcon from "../../Components/Icons/ProductsIcon/ProductsIcon"; @@ -6,9 +6,16 @@ import AddIcon from "../../Components/Icons/AddIcon/AddIcon"; import { Button } from "@mui/material"; import { SampleProducts } from "../../Components/SampleData/SampleData"; import ViewManager from "../../Components/ProductsPage/ViewManager"; +import { Navigate } from "react-router-dom"; +import { LoginState } from "../../Interfaces/Interfaces"; +import { useSelector } from "react-redux"; export default function Products() { const navigate = useNavigate(); + const logged_in = useSelector((state: LoginState) => state.logged_in.value); + if (!logged_in) { + return ; + } return (
diff --git a/src/routes/Inventory/Inventory.tsx b/src/routes/Inventory/Inventory.tsx index 38b8997..170358c 100644 --- a/src/routes/Inventory/Inventory.tsx +++ b/src/routes/Inventory/Inventory.tsx @@ -11,8 +11,15 @@ import { } from "@mui/material"; import { SampleInventoryData } from "../../Components/SampleData/SampleData"; import StockRenderer from "../../Components/InventoryPage/StockRenderer/StockRenderer"; +import { Navigate } from "react-router-dom"; +import { LoginState } from "../../Interfaces/Interfaces"; +import { useSelector } from "react-redux"; export default function Inventory() { + const logged_in = useSelector((state: LoginState) => state.logged_in.value); + if (!logged_in) { + return ; + } return (