Switch to hashrouter for github pages compatibility

This commit is contained in:
keannu125 2023-03-10 18:30:57 +08:00
parent db817e3be1
commit 8af4b9b3ac

View file

@ -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: (
<Container>
<Dashboard />
</Container>
),
errorElement: (
<Container>
<Error />
</Container>
),
},
{
path: "/Products",
element: (
<Container>
<Products />
</Container>
),
},
{
path: "/Inventory",
element: (
<Container>
<Inventory />
</Container>
),
},
{
path: "/Logs",
element: (
<Container>
<Logs />
</Container>
),
},
{
path: "/Login",
element: (
<Container>
<Login />
</Container>
),
},
{
path: "/Product/:id",
element: (
<Container>
<Product />
</Container>
),
},
{
path: "/Activation/:uid/:token",
element: (
<Container>
<Activation />
</Container>
),
},
{
path: "/NewProduct",
element: (
<Container>
<NewProduct />
</Container>
),
},
{
path: "/Register",
element: (
<Container>
<Register />
</Container>
),
},
]);
const router = createHashRouter(
[
{
path: "/",
element: (
<Container>
<Dashboard />
</Container>
),
errorElement: (
<Container>
<Error />
</Container>
),
},
{
path: "/Products",
element: (
<Container>
<Products />
</Container>
),
},
{
path: "/Inventory",
element: (
<Container>
<Inventory />
</Container>
),
},
{
path: "/Logs",
element: (
<Container>
<Logs />
</Container>
),
},
{
path: "/Login",
element: (
<Container>
<Login />
</Container>
),
},
{
path: "/Product/:id",
element: (
<Container>
<Product />
</Container>
),
},
{
path: "/Activation/:uid/:token",
element: (
<Container>
<Activation />
</Container>
),
},
{
path: "/NewProduct",
element: (
<Container>
<NewProduct />
</Container>
),
},
{
path: "/Register",
element: (
<Container>
<Register />
</Container>
),
},
],
{ basename: "/Ivy" }
);
export default function App() {
return (