diff --git a/src/App.tsx b/src/App.tsx index 7fa5633..c32ec4b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,6 +11,7 @@ import Inventory from "./Routes/Inventory/Inventory"; import Login from "./Routes/Login/Login"; import Product from "./Routes/Product/Product"; import Activation from "./Routes/Activation/Activation"; +import AddProduct from "./Routes/AddProduct/AddProduct"; const router = createBrowserRouter([ { @@ -74,6 +75,14 @@ const router = createBrowserRouter([ ), }, + { + path: "/AddProduct", + element: ( + + + + ), + }, ]); export default function App() { diff --git a/src/Routes/AddProduct/AddProduct.tsx b/src/Routes/AddProduct/AddProduct.tsx new file mode 100644 index 0000000..6e2c15e --- /dev/null +++ b/src/Routes/AddProduct/AddProduct.tsx @@ -0,0 +1,44 @@ +import React, { useEffect } from "react"; +import styles from "../../styles"; +import { useNavigate } from "react-router-dom"; +import ProductsIcon from "../../Components/Icons/ProductsIcon/ProductsIcon"; +import AddIcon from "../../Components/Icons/AddIcon/AddIcon"; +import { Button } from "@mui/material"; +import { Navigate } from "react-router-dom"; +import { LoginState } from "../../Interfaces/Interfaces"; +import { useSelector } from "react-redux"; + +export default function AddProduct() { + const navigate = useNavigate(); + const logged_in = useSelector((state: LoginState) => state.logged_in.value); + if (!logged_in) { + return ; + } + return ( +
+
+
+
+ +

+ Add Product +

+
+
+
+
+ +
+ ); +} diff --git a/src/Routes/Login/Login.tsx b/src/Routes/Login/Login.tsx index 7e87812..bd62753 100644 --- a/src/Routes/Login/Login.tsx +++ b/src/Routes/Login/Login.tsx @@ -5,6 +5,9 @@ import { Button } from "@mui/material"; import { useDispatch } from "react-redux"; import { useNavigate } from "react-router-dom"; import { useState } from "react"; +import { Navigate } from "react-router-dom"; +import { LoginState } from "../../Interfaces/Interfaces"; +import { useSelector } from "react-redux"; import { UserInfo, UserLogin } from "../../Components/Api/Api"; import { toggle_login } from "../../Features/Redux/Slices/Login/LoginSlice"; @@ -18,6 +21,10 @@ export default function Login() { password: "", }); const [error, setError] = useState(""); + const logged_in = useSelector((state: LoginState) => state.logged_in.value); + if (logged_in) { + return ; + } return (