mirror of
https://github.com/lemeow125/Ivy-Frontend.git
synced 2024-11-16 22:29:24 +08:00
Revert to browser router
This commit is contained in:
parent
8af4b9b3ac
commit
5d8610056b
3 changed files with 85 additions and 84 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "ivy-inventorymanager",
|
"name": "ivy-inventorymanager",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"homepage": "https://lemeow125.github.io/Ivy",
|
"homepage": "https://lemeow125.github.io/Ivy/#",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.10.5",
|
"@emotion/react": "^11.10.5",
|
||||||
|
|
165
src/App.tsx
165
src/App.tsx
|
@ -7,7 +7,11 @@ import Container from "./Components/Container/Container";
|
||||||
import {
|
import {
|
||||||
createBrowserRouter,
|
createBrowserRouter,
|
||||||
createHashRouter,
|
createHashRouter,
|
||||||
|
HashRouter,
|
||||||
|
Navigate,
|
||||||
|
Route,
|
||||||
RouterProvider,
|
RouterProvider,
|
||||||
|
Routes,
|
||||||
} from "react-router-dom";
|
} from "react-router-dom";
|
||||||
import Store from "./Plugins/Redux/Store/Store";
|
import Store from "./Plugins/Redux/Store/Store";
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
|
@ -21,88 +25,85 @@ import Register from "./Routes/Register/Register";
|
||||||
|
|
||||||
const queryClient = new QueryClient();
|
const queryClient = new QueryClient();
|
||||||
|
|
||||||
const router = createHashRouter(
|
const router = createBrowserRouter([
|
||||||
[
|
{
|
||||||
{
|
path: "/",
|
||||||
path: "/",
|
element: (
|
||||||
element: (
|
<Container>
|
||||||
<Container>
|
<Dashboard />
|
||||||
<Dashboard />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
errorElement: (
|
||||||
errorElement: (
|
<Container>
|
||||||
<Container>
|
<Error />
|
||||||
<Error />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
},
|
||||||
},
|
{
|
||||||
{
|
path: "/Products",
|
||||||
path: "/Products",
|
element: (
|
||||||
element: (
|
<Container>
|
||||||
<Container>
|
<Products />
|
||||||
<Products />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
},
|
||||||
},
|
{
|
||||||
{
|
path: "/Inventory",
|
||||||
path: "/Inventory",
|
element: (
|
||||||
element: (
|
<Container>
|
||||||
<Container>
|
<Inventory />
|
||||||
<Inventory />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
},
|
||||||
},
|
{
|
||||||
{
|
path: "/Logs",
|
||||||
path: "/Logs",
|
element: (
|
||||||
element: (
|
<Container>
|
||||||
<Container>
|
<Logs />
|
||||||
<Logs />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
},
|
||||||
},
|
{
|
||||||
{
|
path: "/Login",
|
||||||
path: "/Login",
|
element: (
|
||||||
element: (
|
<Container>
|
||||||
<Container>
|
<Login />
|
||||||
<Login />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
},
|
||||||
},
|
{
|
||||||
{
|
path: "/Product/:id",
|
||||||
path: "/Product/:id",
|
element: (
|
||||||
element: (
|
<Container>
|
||||||
<Container>
|
<Product />
|
||||||
<Product />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
},
|
||||||
},
|
{
|
||||||
{
|
path: "/Activation/:uid/:token",
|
||||||
path: "/Activation/:uid/:token",
|
element: (
|
||||||
element: (
|
<Container>
|
||||||
<Container>
|
<Activation />
|
||||||
<Activation />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
},
|
||||||
},
|
{
|
||||||
{
|
path: "/NewProduct",
|
||||||
path: "/NewProduct",
|
element: (
|
||||||
element: (
|
<Container>
|
||||||
<Container>
|
<NewProduct />
|
||||||
<NewProduct />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
},
|
||||||
},
|
{
|
||||||
{
|
path: "/Register",
|
||||||
path: "/Register",
|
element: (
|
||||||
element: (
|
<Container>
|
||||||
<Container>
|
<Register />
|
||||||
<Register />
|
</Container>
|
||||||
</Container>
|
),
|
||||||
),
|
},
|
||||||
},
|
]);
|
||||||
],
|
|
||||||
{ basename: "/Ivy" }
|
|
||||||
);
|
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default function LoginChecker() {
|
||||||
if (!logged_in && !old_session_checked) {
|
if (!logged_in && !old_session_checked) {
|
||||||
} else if (!logged_in && old_session_checked) {
|
} else if (!logged_in && old_session_checked) {
|
||||||
console.log("Not logged in. Redirecting to login page");
|
console.log("Not logged in. Redirecting to login page");
|
||||||
return <Navigate to="/Login" replace />;
|
return <Navigate to="Ivy/Login" replace />;
|
||||||
}
|
}
|
||||||
return <div />;
|
return <div />;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue