From 8af4b9b3acb5a96d3b96447a2cf83a617c4a7af6 Mon Sep 17 00:00:00 2001 From: keannu125 Date: Fri, 10 Mar 2023 18:30:57 +0800 Subject: [PATCH] Switch to hashrouter for github pages compatibility --- src/App.tsx | 167 +++++++++++++++++++++++++++------------------------- 1 file changed, 87 insertions(+), 80 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index e6dd886..b38470d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,7 +4,11 @@ import Error from "./Routes/Error/Error"; import Products from "./Routes/Products/Products"; import Logs from "./Routes/Logs/Logs"; import Container from "./Components/Container/Container"; -import { createBrowserRouter, RouterProvider } from "react-router-dom"; +import { + createBrowserRouter, + createHashRouter, + RouterProvider, +} from "react-router-dom"; import Store from "./Plugins/Redux/Store/Store"; import { Provider } from "react-redux"; import Inventory from "./Routes/Inventory/Inventory"; @@ -17,85 +21,88 @@ import Register from "./Routes/Register/Register"; const queryClient = new QueryClient(); -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: ( - - - - ), - }, -]); +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" } +); export default function App() { return (