diff --git a/frontend/src/routes/app/_hiddenLayout/app-settings.tsx b/frontend/src/routes/app/_hiddenLayout/app-settings.tsx index d5a542e..f978f79 100644 --- a/frontend/src/routes/app/_hiddenLayout/app-settings.tsx +++ b/frontend/src/routes/app/_hiddenLayout/app-settings.tsx @@ -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"; export const Route = createFileRoute("/app/_hiddenLayout/app-settings")({ + beforeLoad: async () => { + if (!(await isAuthenticated())) { + throw redirect({ + to: "/login", + }); + } + }, component: RouteComponent, }); diff --git a/frontend/src/routes/app/_hiddenLayout/storages.tsx b/frontend/src/routes/app/_hiddenLayout/storages.tsx index aedf9de..23a7c33 100644 --- a/frontend/src/routes/app/_hiddenLayout/storages.tsx +++ b/frontend/src/routes/app/_hiddenLayout/storages.tsx @@ -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"; export const Route = createFileRoute("/app/_hiddenLayout/storages")({ + beforeLoad: async () => { + if (!(await isAuthenticated())) { + throw redirect({ + to: "/login", + }); + } + }, component: RouteComponent, });