improved frontend routing
This commit is contained in:
@@ -1,7 +1,15 @@
|
|||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||||
|
import { isAuthenticated } from "../../../utils/auth";
|
||||||
import { Settings } from "../../../pages/Settings";
|
import { Settings } from "../../../pages/Settings";
|
||||||
|
|
||||||
export const Route = createFileRoute("/app/_hiddenLayout/app-settings")({
|
export const Route = createFileRoute("/app/_hiddenLayout/app-settings")({
|
||||||
|
beforeLoad: async () => {
|
||||||
|
if (!(await isAuthenticated())) {
|
||||||
|
throw redirect({
|
||||||
|
to: "/login",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||||
|
import { isAuthenticated } from "../../../utils/auth";
|
||||||
import { Storages } from "../../../pages/Storages";
|
import { Storages } from "../../../pages/Storages";
|
||||||
|
|
||||||
export const Route = createFileRoute("/app/_hiddenLayout/storages")({
|
export const Route = createFileRoute("/app/_hiddenLayout/storages")({
|
||||||
|
beforeLoad: async () => {
|
||||||
|
if (!(await isAuthenticated())) {
|
||||||
|
throw redirect({
|
||||||
|
to: "/login",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user