From 5d8610056bd4e409cb30131a9beddda440dfda76 Mon Sep 17 00:00:00 2001 From: keannu125 Date: Fri, 10 Mar 2023 19:36:40 +0800 Subject: [PATCH] Revert to browser router --- package.json | 2 +- src/App.tsx | 165 ++++++++++--------- src/Components/LoginChecker/LoginChecker.tsx | 2 +- 3 files changed, 85 insertions(+), 84 deletions(-) diff --git a/package.json b/package.json index 04fec28..17997f8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ivy-inventorymanager", "version": "0.1.0", - "homepage": "https://lemeow125.github.io/Ivy", + "homepage": "https://lemeow125.github.io/Ivy/#", "private": true, "dependencies": { "@emotion/react": "^11.10.5", diff --git a/src/App.tsx b/src/App.tsx index b38470d..c3da8b4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -7,7 +7,11 @@ import Container from "./Components/Container/Container"; import { createBrowserRouter, createHashRouter, + HashRouter, + Navigate, + Route, RouterProvider, + Routes, } from "react-router-dom"; import Store from "./Plugins/Redux/Store/Store"; import { Provider } from "react-redux"; @@ -21,88 +25,85 @@ import Register from "./Routes/Register/Register"; const queryClient = new QueryClient(); -const router = createHashRouter( - [ - { - path: "/", - element: ( - - - - ), - errorElement: ( - - - - ), - }, - { - path: "/Products", - element: ( - - - - ), - }, - { - path: "/Inventory", - element: ( - - - - ), - }, - { - path: "/Logs", - element: ( - - - - ), - }, - { - path: "/Login", - element: ( - - - - ), - }, - { - path: "/Product/:id", - element: ( - - - - ), - }, - { - path: "/Activation/:uid/:token", - element: ( - - - - ), - }, - { - path: "/NewProduct", - element: ( - - - - ), - }, - { - path: "/Register", - element: ( - - - - ), - }, - ], - { basename: "/Ivy" } -); +const router = createBrowserRouter([ + { + path: "/", + element: ( + + + + ), + errorElement: ( + + + + ), + }, + { + path: "/Products", + element: ( + + + + ), + }, + { + path: "/Inventory", + element: ( + + + + ), + }, + { + path: "/Logs", + element: ( + + + + ), + }, + { + path: "/Login", + element: ( + + + + ), + }, + { + path: "/Product/:id", + element: ( + + + + ), + }, + { + path: "/Activation/:uid/:token", + element: ( + + + + ), + }, + { + path: "/NewProduct", + element: ( + + + + ), + }, + { + path: "/Register", + element: ( + + + + ), + }, +]); export default function App() { return ( diff --git a/src/Components/LoginChecker/LoginChecker.tsx b/src/Components/LoginChecker/LoginChecker.tsx index 07d8bed..18e359f 100644 --- a/src/Components/LoginChecker/LoginChecker.tsx +++ b/src/Components/LoginChecker/LoginChecker.tsx @@ -14,7 +14,7 @@ export default function LoginChecker() { if (!logged_in && !old_session_checked) { } else if (!logged_in && old_session_checked) { console.log("Not logged in. Redirecting to login page"); - return ; + return ; } return
; }