2023-03-06 13:06:43 +08:00
|
|
|
import React, { useEffect } from "react";
|
2023-02-14 20:54:18 +08:00
|
|
|
import Dashboard from "./Routes/Dashboard/Dashboard";
|
2023-02-15 00:32:29 +08:00
|
|
|
import Error from "./Routes/Error/Error";
|
|
|
|
import Products from "./Routes/Products/Products";
|
2023-02-24 17:50:39 +08:00
|
|
|
import Logs from "./Routes/Logs/Logs";
|
2023-02-14 23:59:34 +08:00
|
|
|
import Container from "./Components/Container/Container";
|
2023-03-10 18:30:57 +08:00
|
|
|
import {
|
|
|
|
createBrowserRouter,
|
|
|
|
createHashRouter,
|
|
|
|
RouterProvider,
|
|
|
|
} from "react-router-dom";
|
2023-02-14 21:10:17 +08:00
|
|
|
import Store from "./Plugins/Redux/Store/Store";
|
|
|
|
import { Provider } from "react-redux";
|
2023-03-02 20:47:12 +08:00
|
|
|
import Inventory from "./Routes/Inventory/Inventory";
|
2023-03-06 00:56:21 +08:00
|
|
|
import Login from "./Routes/Login/Login";
|
2023-03-06 13:59:16 +08:00
|
|
|
import Product from "./Routes/Product/Product";
|
2023-03-06 14:28:18 +08:00
|
|
|
import Activation from "./Routes/Activation/Activation";
|
2023-03-06 15:38:21 +08:00
|
|
|
import { QueryClient, QueryClientProvider } from "react-query";
|
|
|
|
import NewProduct from "./Routes/NewProduct/NewProduct";
|
2023-03-06 22:51:59 +08:00
|
|
|
import Register from "./Routes/Register/Register";
|
2023-03-06 15:38:21 +08:00
|
|
|
|
|
|
|
const queryClient = new QueryClient();
|
2023-02-12 15:19:17 +08:00
|
|
|
|
2023-03-10 18:30:57 +08:00
|
|
|
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" }
|
|
|
|
);
|
2023-02-14 21:10:17 +08:00
|
|
|
|
2023-02-13 22:49:32 +08:00
|
|
|
export default function App() {
|
2023-02-12 15:19:17 +08:00
|
|
|
return (
|
2023-03-06 13:06:43 +08:00
|
|
|
<Provider store={Store}>
|
2023-03-06 15:38:21 +08:00
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
<RouterProvider router={router} />
|
|
|
|
</QueryClientProvider>
|
2023-03-06 13:06:43 +08:00
|
|
|
</Provider>
|
2023-02-12 15:19:17 +08:00
|
|
|
);
|
|
|
|
}
|