Ivy-Frontend/src/App.tsx

100 lines
2 KiB
TypeScript
Raw Normal View History

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";
import Error from "./Routes/Error/Error";
import Products from "./Routes/Products/Products";
import Logs from "./Routes/Logs/Logs";
2023-02-14 23:59:34 +08:00
import Container from "./Components/Container/Container";
import { createBrowserRouter, 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";
import Inventory from "./Routes/Inventory/Inventory";
2023-03-06 00:56:21 +08:00
import Login from "./Routes/Login/Login";
import Product from "./Routes/Product/Product";
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";
const queryClient = new QueryClient();
const router = createBrowserRouter([
{
path: "/",
2023-02-15 12:31:28 +08:00
element: (
2023-02-15 12:32:35 +08:00
<Container>
<Dashboard />
</Container>
2023-02-15 12:31:28 +08:00
),
errorElement: (
2023-02-15 12:32:35 +08:00
<Container>
<Error />
</Container>
2023-02-15 12:31:28 +08:00
),
},
{
path: "/Products",
2023-02-15 12:31:28 +08:00
element: (
2023-02-15 12:32:35 +08:00
<Container>
<Products />
</Container>
2023-02-15 12:31:28 +08:00
),
},
{
path: "/Inventory",
element: (
<Container>
<Inventory />
</Container>
),
},
2023-02-25 18:49:36 +08:00
{
path: "/Logs",
2023-02-25 18:49:36 +08:00
element: (
<Container>
<Logs />
2023-02-25 18:49:36 +08:00
</Container>
),
},
2023-03-06 00:56:21 +08:00
{
path: "/Login",
element: (
<Container>
<Login />
</Container>
),
},
{
path: "/Product/:id",
element: (
<Container>
<Product />
</Container>
),
},
{
path: "/Activation/:uid/:token",
element: (
<Container>
<Activation />
</Container>
),
},
{
2023-03-06 15:38:21 +08:00
path: "/NewProduct",
element: (
<Container>
2023-03-06 15:38:21 +08:00
<NewProduct />
</Container>
),
},
]);
2023-02-14 21:10:17 +08:00
2023-02-13 22:49:32 +08:00
export default function App() {
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>
);
}