2023-02-13 22:11:25 +08:00
|
|
|
import React 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-02-14 20:29:42 +08:00
|
|
|
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";
|
2023-02-27 01:51:50 +08:00
|
|
|
import AddProduct from "./Routes/Products/AddProduct/AddProduct";
|
2023-02-27 14:12:25 +08:00
|
|
|
import EditProduct from "./Routes/Products/EditProduct/EditProduct";
|
2023-02-12 15:19:17 +08:00
|
|
|
|
2023-02-14 20:29:42 +08:00
|
|
|
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
|
|
|
),
|
2023-02-15 00:32:29 +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
|
|
|
),
|
2023-02-14 20:29:42 +08:00
|
|
|
},
|
2023-02-25 18:49:36 +08:00
|
|
|
{
|
2023-02-24 17:50:39 +08:00
|
|
|
path: "/Logs",
|
2023-02-25 18:49:36 +08:00
|
|
|
element: (
|
|
|
|
<Container>
|
2023-02-24 17:50:39 +08:00
|
|
|
<Logs />
|
2023-02-25 18:49:36 +08:00
|
|
|
</Container>
|
|
|
|
),
|
|
|
|
},
|
2023-02-27 01:51:50 +08:00
|
|
|
{
|
|
|
|
path: "/Products/AddProduct",
|
|
|
|
element: (
|
|
|
|
<Container>
|
|
|
|
<AddProduct />
|
|
|
|
</Container>
|
|
|
|
),
|
|
|
|
},
|
2023-02-27 14:12:25 +08:00
|
|
|
{
|
|
|
|
path: "/Products/EditProduct/:id", // Updated route with dynamic id parameter
|
|
|
|
element: (
|
|
|
|
<Container>
|
|
|
|
<EditProduct />
|
|
|
|
</Container>
|
|
|
|
),
|
|
|
|
},
|
2023-02-14 20:29:42 +08:00
|
|
|
]);
|
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-02-14 20:29:42 +08:00
|
|
|
<React.StrictMode>
|
2023-02-14 21:10:17 +08:00
|
|
|
<Provider store={Store}>
|
2023-02-15 12:31:28 +08:00
|
|
|
<RouterProvider router={router} />
|
2023-02-14 21:10:17 +08:00
|
|
|
</Provider>
|
2023-02-14 20:29:42 +08:00
|
|
|
</React.StrictMode>
|
2023-02-12 15:19:17 +08:00
|
|
|
);
|
|
|
|
}
|