From e2a7d2e5603a77c1789e69a466afbe5976e310c3 Mon Sep 17 00:00:00 2001 From: Theis Gaedigk Date: Fri, 10 Jul 2026 11:53:07 +0200 Subject: [PATCH] refactor: add _authed.tsx guard that checks the protected routes if the user is logged in --- frontend/src/routeTree.gen.ts | 222 ++++++++++-------- .../src/routes/app/_hiddenLayout/_authed.tsx | 9 + .../app/_hiddenLayout/_authed/add-product.tsx | 10 + .../_hiddenLayout/_authed/app-settings.tsx | 12 + .../app/_hiddenLayout/_authed/inventory.tsx | 10 + .../app/_hiddenLayout/_authed/storages.tsx | 10 + .../_hiddenLayout/_authed/view-product.tsx | 17 ++ .../routes/app/_hiddenLayout/add-product.tsx | 14 -- .../routes/app/_hiddenLayout/app-settings.tsx | 14 -- .../routes/app/_hiddenLayout/inventory.tsx | 14 -- .../src/routes/app/_hiddenLayout/storages.tsx | 14 -- .../routes/app/_hiddenLayout/view-product.tsx | 19 -- 12 files changed, 193 insertions(+), 172 deletions(-) create mode 100644 frontend/src/routes/app/_hiddenLayout/_authed.tsx create mode 100644 frontend/src/routes/app/_hiddenLayout/_authed/add-product.tsx create mode 100644 frontend/src/routes/app/_hiddenLayout/_authed/app-settings.tsx create mode 100644 frontend/src/routes/app/_hiddenLayout/_authed/inventory.tsx create mode 100644 frontend/src/routes/app/_hiddenLayout/_authed/storages.tsx create mode 100644 frontend/src/routes/app/_hiddenLayout/_authed/view-product.tsx delete mode 100644 frontend/src/routes/app/_hiddenLayout/add-product.tsx delete mode 100644 frontend/src/routes/app/_hiddenLayout/app-settings.tsx delete mode 100644 frontend/src/routes/app/_hiddenLayout/inventory.tsx delete mode 100644 frontend/src/routes/app/_hiddenLayout/storages.tsx delete mode 100644 frontend/src/routes/app/_hiddenLayout/view-product.tsx diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts index 2616c49..1b64831 100644 --- a/frontend/src/routeTree.gen.ts +++ b/frontend/src/routeTree.gen.ts @@ -12,12 +12,13 @@ import { Route as rootRouteImport } from './routes/__root' import { Route as LoginRouteImport } from './routes/login' import { Route as IndexRouteImport } from './routes/index' import { Route as AppHiddenLayoutRouteImport } from './routes/app/_hiddenLayout' -import { Route as AppHiddenLayoutViewProductRouteImport } from './routes/app/_hiddenLayout/view-product' -import { Route as AppHiddenLayoutStoragesRouteImport } from './routes/app/_hiddenLayout/storages' -import { Route as AppHiddenLayoutInventoryRouteImport } from './routes/app/_hiddenLayout/inventory' -import { Route as AppHiddenLayoutAppSettingsRouteImport } from './routes/app/_hiddenLayout/app-settings' -import { Route as AppHiddenLayoutAddProductRouteImport } from './routes/app/_hiddenLayout/add-product' +import { Route as AppHiddenLayoutAuthedRouteImport } from './routes/app/_hiddenLayout/_authed' import { Route as AppHiddenLayoutQuickViewProductRouteImport } from './routes/app/_hiddenLayout/quick-view/product' +import { Route as AppHiddenLayoutAuthedViewProductRouteImport } from './routes/app/_hiddenLayout/_authed/view-product' +import { Route as AppHiddenLayoutAuthedStoragesRouteImport } from './routes/app/_hiddenLayout/_authed/storages' +import { Route as AppHiddenLayoutAuthedInventoryRouteImport } from './routes/app/_hiddenLayout/_authed/inventory' +import { Route as AppHiddenLayoutAuthedAppSettingsRouteImport } from './routes/app/_hiddenLayout/_authed/app-settings' +import { Route as AppHiddenLayoutAuthedAddProductRouteImport } from './routes/app/_hiddenLayout/_authed/add-product' const LoginRoute = LoginRouteImport.update({ id: '/login', @@ -34,62 +35,67 @@ const AppHiddenLayoutRoute = AppHiddenLayoutRouteImport.update({ path: '/app', getParentRoute: () => rootRouteImport, } as any) -const AppHiddenLayoutViewProductRoute = - AppHiddenLayoutViewProductRouteImport.update({ - id: '/view-product', - path: '/view-product', - getParentRoute: () => AppHiddenLayoutRoute, - } as any) -const AppHiddenLayoutStoragesRoute = AppHiddenLayoutStoragesRouteImport.update({ - id: '/storages', - path: '/storages', +const AppHiddenLayoutAuthedRoute = AppHiddenLayoutAuthedRouteImport.update({ + id: '/_authed', getParentRoute: () => AppHiddenLayoutRoute, } as any) -const AppHiddenLayoutInventoryRoute = - AppHiddenLayoutInventoryRouteImport.update({ - id: '/inventory', - path: '/inventory', - getParentRoute: () => AppHiddenLayoutRoute, - } as any) -const AppHiddenLayoutAppSettingsRoute = - AppHiddenLayoutAppSettingsRouteImport.update({ - id: '/app-settings', - path: '/app-settings', - getParentRoute: () => AppHiddenLayoutRoute, - } as any) -const AppHiddenLayoutAddProductRoute = - AppHiddenLayoutAddProductRouteImport.update({ - id: '/add-product', - path: '/add-product', - getParentRoute: () => AppHiddenLayoutRoute, - } as any) const AppHiddenLayoutQuickViewProductRoute = AppHiddenLayoutQuickViewProductRouteImport.update({ id: '/quick-view/product', path: '/quick-view/product', getParentRoute: () => AppHiddenLayoutRoute, } as any) +const AppHiddenLayoutAuthedViewProductRoute = + AppHiddenLayoutAuthedViewProductRouteImport.update({ + id: '/view-product', + path: '/view-product', + getParentRoute: () => AppHiddenLayoutAuthedRoute, + } as any) +const AppHiddenLayoutAuthedStoragesRoute = + AppHiddenLayoutAuthedStoragesRouteImport.update({ + id: '/storages', + path: '/storages', + getParentRoute: () => AppHiddenLayoutAuthedRoute, + } as any) +const AppHiddenLayoutAuthedInventoryRoute = + AppHiddenLayoutAuthedInventoryRouteImport.update({ + id: '/inventory', + path: '/inventory', + getParentRoute: () => AppHiddenLayoutAuthedRoute, + } as any) +const AppHiddenLayoutAuthedAppSettingsRoute = + AppHiddenLayoutAuthedAppSettingsRouteImport.update({ + id: '/app-settings', + path: '/app-settings', + getParentRoute: () => AppHiddenLayoutAuthedRoute, + } as any) +const AppHiddenLayoutAuthedAddProductRoute = + AppHiddenLayoutAuthedAddProductRouteImport.update({ + id: '/add-product', + path: '/add-product', + getParentRoute: () => AppHiddenLayoutAuthedRoute, + } as any) export interface FileRoutesByFullPath { '/': typeof IndexRoute '/login': typeof LoginRoute - '/app': typeof AppHiddenLayoutRouteWithChildren - '/app/add-product': typeof AppHiddenLayoutAddProductRoute - '/app/app-settings': typeof AppHiddenLayoutAppSettingsRoute - '/app/inventory': typeof AppHiddenLayoutInventoryRoute - '/app/storages': typeof AppHiddenLayoutStoragesRoute - '/app/view-product': typeof AppHiddenLayoutViewProductRoute + '/app': typeof AppHiddenLayoutAuthedRouteWithChildren + '/app/add-product': typeof AppHiddenLayoutAuthedAddProductRoute + '/app/app-settings': typeof AppHiddenLayoutAuthedAppSettingsRoute + '/app/inventory': typeof AppHiddenLayoutAuthedInventoryRoute + '/app/storages': typeof AppHiddenLayoutAuthedStoragesRoute + '/app/view-product': typeof AppHiddenLayoutAuthedViewProductRoute '/app/quick-view/product': typeof AppHiddenLayoutQuickViewProductRoute } export interface FileRoutesByTo { '/': typeof IndexRoute '/login': typeof LoginRoute - '/app': typeof AppHiddenLayoutRouteWithChildren - '/app/add-product': typeof AppHiddenLayoutAddProductRoute - '/app/app-settings': typeof AppHiddenLayoutAppSettingsRoute - '/app/inventory': typeof AppHiddenLayoutInventoryRoute - '/app/storages': typeof AppHiddenLayoutStoragesRoute - '/app/view-product': typeof AppHiddenLayoutViewProductRoute + '/app': typeof AppHiddenLayoutAuthedRouteWithChildren + '/app/add-product': typeof AppHiddenLayoutAuthedAddProductRoute + '/app/app-settings': typeof AppHiddenLayoutAuthedAppSettingsRoute + '/app/inventory': typeof AppHiddenLayoutAuthedInventoryRoute + '/app/storages': typeof AppHiddenLayoutAuthedStoragesRoute + '/app/view-product': typeof AppHiddenLayoutAuthedViewProductRoute '/app/quick-view/product': typeof AppHiddenLayoutQuickViewProductRoute } export interface FileRoutesById { @@ -97,11 +103,12 @@ export interface FileRoutesById { '/': typeof IndexRoute '/login': typeof LoginRoute '/app/_hiddenLayout': typeof AppHiddenLayoutRouteWithChildren - '/app/_hiddenLayout/add-product': typeof AppHiddenLayoutAddProductRoute - '/app/_hiddenLayout/app-settings': typeof AppHiddenLayoutAppSettingsRoute - '/app/_hiddenLayout/inventory': typeof AppHiddenLayoutInventoryRoute - '/app/_hiddenLayout/storages': typeof AppHiddenLayoutStoragesRoute - '/app/_hiddenLayout/view-product': typeof AppHiddenLayoutViewProductRoute + '/app/_hiddenLayout/_authed': typeof AppHiddenLayoutAuthedRouteWithChildren + '/app/_hiddenLayout/_authed/add-product': typeof AppHiddenLayoutAuthedAddProductRoute + '/app/_hiddenLayout/_authed/app-settings': typeof AppHiddenLayoutAuthedAppSettingsRoute + '/app/_hiddenLayout/_authed/inventory': typeof AppHiddenLayoutAuthedInventoryRoute + '/app/_hiddenLayout/_authed/storages': typeof AppHiddenLayoutAuthedStoragesRoute + '/app/_hiddenLayout/_authed/view-product': typeof AppHiddenLayoutAuthedViewProductRoute '/app/_hiddenLayout/quick-view/product': typeof AppHiddenLayoutQuickViewProductRoute } export interface FileRouteTypes { @@ -132,11 +139,12 @@ export interface FileRouteTypes { | '/' | '/login' | '/app/_hiddenLayout' - | '/app/_hiddenLayout/add-product' - | '/app/_hiddenLayout/app-settings' - | '/app/_hiddenLayout/inventory' - | '/app/_hiddenLayout/storages' - | '/app/_hiddenLayout/view-product' + | '/app/_hiddenLayout/_authed' + | '/app/_hiddenLayout/_authed/add-product' + | '/app/_hiddenLayout/_authed/app-settings' + | '/app/_hiddenLayout/_authed/inventory' + | '/app/_hiddenLayout/_authed/storages' + | '/app/_hiddenLayout/_authed/view-product' | '/app/_hiddenLayout/quick-view/product' fileRoutesById: FileRoutesById } @@ -169,39 +177,11 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof AppHiddenLayoutRouteImport parentRoute: typeof rootRouteImport } - '/app/_hiddenLayout/view-product': { - id: '/app/_hiddenLayout/view-product' - path: '/view-product' - fullPath: '/app/view-product' - preLoaderRoute: typeof AppHiddenLayoutViewProductRouteImport - parentRoute: typeof AppHiddenLayoutRoute - } - '/app/_hiddenLayout/storages': { - id: '/app/_hiddenLayout/storages' - path: '/storages' - fullPath: '/app/storages' - preLoaderRoute: typeof AppHiddenLayoutStoragesRouteImport - parentRoute: typeof AppHiddenLayoutRoute - } - '/app/_hiddenLayout/inventory': { - id: '/app/_hiddenLayout/inventory' - path: '/inventory' - fullPath: '/app/inventory' - preLoaderRoute: typeof AppHiddenLayoutInventoryRouteImport - parentRoute: typeof AppHiddenLayoutRoute - } - '/app/_hiddenLayout/app-settings': { - id: '/app/_hiddenLayout/app-settings' - path: '/app-settings' - fullPath: '/app/app-settings' - preLoaderRoute: typeof AppHiddenLayoutAppSettingsRouteImport - parentRoute: typeof AppHiddenLayoutRoute - } - '/app/_hiddenLayout/add-product': { - id: '/app/_hiddenLayout/add-product' - path: '/add-product' - fullPath: '/app/add-product' - preLoaderRoute: typeof AppHiddenLayoutAddProductRouteImport + '/app/_hiddenLayout/_authed': { + id: '/app/_hiddenLayout/_authed' + path: '' + fullPath: '/app' + preLoaderRoute: typeof AppHiddenLayoutAuthedRouteImport parentRoute: typeof AppHiddenLayoutRoute } '/app/_hiddenLayout/quick-view/product': { @@ -211,24 +191,72 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof AppHiddenLayoutQuickViewProductRouteImport parentRoute: typeof AppHiddenLayoutRoute } + '/app/_hiddenLayout/_authed/view-product': { + id: '/app/_hiddenLayout/_authed/view-product' + path: '/view-product' + fullPath: '/app/view-product' + preLoaderRoute: typeof AppHiddenLayoutAuthedViewProductRouteImport + parentRoute: typeof AppHiddenLayoutAuthedRoute + } + '/app/_hiddenLayout/_authed/storages': { + id: '/app/_hiddenLayout/_authed/storages' + path: '/storages' + fullPath: '/app/storages' + preLoaderRoute: typeof AppHiddenLayoutAuthedStoragesRouteImport + parentRoute: typeof AppHiddenLayoutAuthedRoute + } + '/app/_hiddenLayout/_authed/inventory': { + id: '/app/_hiddenLayout/_authed/inventory' + path: '/inventory' + fullPath: '/app/inventory' + preLoaderRoute: typeof AppHiddenLayoutAuthedInventoryRouteImport + parentRoute: typeof AppHiddenLayoutAuthedRoute + } + '/app/_hiddenLayout/_authed/app-settings': { + id: '/app/_hiddenLayout/_authed/app-settings' + path: '/app-settings' + fullPath: '/app/app-settings' + preLoaderRoute: typeof AppHiddenLayoutAuthedAppSettingsRouteImport + parentRoute: typeof AppHiddenLayoutAuthedRoute + } + '/app/_hiddenLayout/_authed/add-product': { + id: '/app/_hiddenLayout/_authed/add-product' + path: '/add-product' + fullPath: '/app/add-product' + preLoaderRoute: typeof AppHiddenLayoutAuthedAddProductRouteImport + parentRoute: typeof AppHiddenLayoutAuthedRoute + } } } +interface AppHiddenLayoutAuthedRouteChildren { + AppHiddenLayoutAuthedAddProductRoute: typeof AppHiddenLayoutAuthedAddProductRoute + AppHiddenLayoutAuthedAppSettingsRoute: typeof AppHiddenLayoutAuthedAppSettingsRoute + AppHiddenLayoutAuthedInventoryRoute: typeof AppHiddenLayoutAuthedInventoryRoute + AppHiddenLayoutAuthedStoragesRoute: typeof AppHiddenLayoutAuthedStoragesRoute + AppHiddenLayoutAuthedViewProductRoute: typeof AppHiddenLayoutAuthedViewProductRoute +} + +const AppHiddenLayoutAuthedRouteChildren: AppHiddenLayoutAuthedRouteChildren = { + AppHiddenLayoutAuthedAddProductRoute: AppHiddenLayoutAuthedAddProductRoute, + AppHiddenLayoutAuthedAppSettingsRoute: AppHiddenLayoutAuthedAppSettingsRoute, + AppHiddenLayoutAuthedInventoryRoute: AppHiddenLayoutAuthedInventoryRoute, + AppHiddenLayoutAuthedStoragesRoute: AppHiddenLayoutAuthedStoragesRoute, + AppHiddenLayoutAuthedViewProductRoute: AppHiddenLayoutAuthedViewProductRoute, +} + +const AppHiddenLayoutAuthedRouteWithChildren = + AppHiddenLayoutAuthedRoute._addFileChildren( + AppHiddenLayoutAuthedRouteChildren, + ) + interface AppHiddenLayoutRouteChildren { - AppHiddenLayoutAddProductRoute: typeof AppHiddenLayoutAddProductRoute - AppHiddenLayoutAppSettingsRoute: typeof AppHiddenLayoutAppSettingsRoute - AppHiddenLayoutInventoryRoute: typeof AppHiddenLayoutInventoryRoute - AppHiddenLayoutStoragesRoute: typeof AppHiddenLayoutStoragesRoute - AppHiddenLayoutViewProductRoute: typeof AppHiddenLayoutViewProductRoute + AppHiddenLayoutAuthedRoute: typeof AppHiddenLayoutAuthedRouteWithChildren AppHiddenLayoutQuickViewProductRoute: typeof AppHiddenLayoutQuickViewProductRoute } const AppHiddenLayoutRouteChildren: AppHiddenLayoutRouteChildren = { - AppHiddenLayoutAddProductRoute: AppHiddenLayoutAddProductRoute, - AppHiddenLayoutAppSettingsRoute: AppHiddenLayoutAppSettingsRoute, - AppHiddenLayoutInventoryRoute: AppHiddenLayoutInventoryRoute, - AppHiddenLayoutStoragesRoute: AppHiddenLayoutStoragesRoute, - AppHiddenLayoutViewProductRoute: AppHiddenLayoutViewProductRoute, + AppHiddenLayoutAuthedRoute: AppHiddenLayoutAuthedRouteWithChildren, AppHiddenLayoutQuickViewProductRoute: AppHiddenLayoutQuickViewProductRoute, } diff --git a/frontend/src/routes/app/_hiddenLayout/_authed.tsx b/frontend/src/routes/app/_hiddenLayout/_authed.tsx new file mode 100644 index 0000000..e1f122b --- /dev/null +++ b/frontend/src/routes/app/_hiddenLayout/_authed.tsx @@ -0,0 +1,9 @@ +import { createFileRoute, Outlet } from "@tanstack/react-router"; +import { verifyLogin } from "../../../utils/api/auth"; + +export const Route = createFileRoute("/app/_hiddenLayout/_authed")({ + beforeLoad: async () => { + await verifyLogin(); + }, + component: () => , +}); diff --git a/frontend/src/routes/app/_hiddenLayout/_authed/add-product.tsx b/frontend/src/routes/app/_hiddenLayout/_authed/add-product.tsx new file mode 100644 index 0000000..97fe241 --- /dev/null +++ b/frontend/src/routes/app/_hiddenLayout/_authed/add-product.tsx @@ -0,0 +1,10 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { AddProduct } from "../../../../pages/AddProduct"; + +export const Route = createFileRoute("/app/_hiddenLayout/_authed/add-product")({ + component: RouteComponent, +}); + +function RouteComponent() { + return ; +} diff --git a/frontend/src/routes/app/_hiddenLayout/_authed/app-settings.tsx b/frontend/src/routes/app/_hiddenLayout/_authed/app-settings.tsx new file mode 100644 index 0000000..1379f8e --- /dev/null +++ b/frontend/src/routes/app/_hiddenLayout/_authed/app-settings.tsx @@ -0,0 +1,12 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { Settings } from "../../../../pages/Settings"; + +export const Route = createFileRoute("/app/_hiddenLayout/_authed/app-settings")( + { + component: RouteComponent, + }, +); + +function RouteComponent() { + return ; +} diff --git a/frontend/src/routes/app/_hiddenLayout/_authed/inventory.tsx b/frontend/src/routes/app/_hiddenLayout/_authed/inventory.tsx new file mode 100644 index 0000000..025846e --- /dev/null +++ b/frontend/src/routes/app/_hiddenLayout/_authed/inventory.tsx @@ -0,0 +1,10 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { InventoryPage } from "../../../../pages/Inventory"; + +export const Route = createFileRoute("/app/_hiddenLayout/_authed/inventory")({ + component: RouteComponent, +}); + +function RouteComponent() { + return ; +} diff --git a/frontend/src/routes/app/_hiddenLayout/_authed/storages.tsx b/frontend/src/routes/app/_hiddenLayout/_authed/storages.tsx new file mode 100644 index 0000000..d501a61 --- /dev/null +++ b/frontend/src/routes/app/_hiddenLayout/_authed/storages.tsx @@ -0,0 +1,10 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { Storages } from "../../../../pages/Storages"; + +export const Route = createFileRoute("/app/_hiddenLayout/_authed/storages")({ + component: RouteComponent, +}); + +function RouteComponent() { + return ; +} diff --git a/frontend/src/routes/app/_hiddenLayout/_authed/view-product.tsx b/frontend/src/routes/app/_hiddenLayout/_authed/view-product.tsx new file mode 100644 index 0000000..9549a0f --- /dev/null +++ b/frontend/src/routes/app/_hiddenLayout/_authed/view-product.tsx @@ -0,0 +1,17 @@ +import { createFileRoute } from "@tanstack/react-router"; +import { z } from "zod"; +import { ViewProduct } from "../../../../pages/ViewProduct"; + +export const Route = createFileRoute("/app/_hiddenLayout/_authed/view-product")( + { + validateSearch: z.object({ + product: z.string(), + }), + component: RouteComponent, + }, +); + +function RouteComponent() { + const { product } = Route.useSearch(); + return ; +} diff --git a/frontend/src/routes/app/_hiddenLayout/add-product.tsx b/frontend/src/routes/app/_hiddenLayout/add-product.tsx deleted file mode 100644 index 17f1080..0000000 --- a/frontend/src/routes/app/_hiddenLayout/add-product.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from "@tanstack/react-router"; -import { verifyLogin } from "../../../utils/api/auth"; -import { AddProduct } from "../../../pages/AddProduct"; - -export const Route = createFileRoute("/app/_hiddenLayout/add-product")({ - beforeLoad: async () => { - await verifyLogin(); - }, - component: RouteComponent, -}); - -function RouteComponent() { - return ; -} diff --git a/frontend/src/routes/app/_hiddenLayout/app-settings.tsx b/frontend/src/routes/app/_hiddenLayout/app-settings.tsx deleted file mode 100644 index f38e759..0000000 --- a/frontend/src/routes/app/_hiddenLayout/app-settings.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from "@tanstack/react-router"; -import { verifyLogin } from "../../../utils/api/auth"; -import { Settings } from "../../../pages/Settings"; - -export const Route = createFileRoute("/app/_hiddenLayout/app-settings")({ - beforeLoad: async () => { - await verifyLogin(); - }, - component: RouteComponent, -}); - -function RouteComponent() { - return ; -} diff --git a/frontend/src/routes/app/_hiddenLayout/inventory.tsx b/frontend/src/routes/app/_hiddenLayout/inventory.tsx deleted file mode 100644 index e5bca7e..0000000 --- a/frontend/src/routes/app/_hiddenLayout/inventory.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from "@tanstack/react-router"; -import { verifyLogin } from "../../../utils/api/auth"; -import { InventoryPage } from "../../../pages/Inventory"; - -export const Route = createFileRoute("/app/_hiddenLayout/inventory")({ - beforeLoad: async () => { - await verifyLogin(); - }, - component: RouteComponent, -}); - -function RouteComponent() { - return ; -} diff --git a/frontend/src/routes/app/_hiddenLayout/storages.tsx b/frontend/src/routes/app/_hiddenLayout/storages.tsx deleted file mode 100644 index 622feb3..0000000 --- a/frontend/src/routes/app/_hiddenLayout/storages.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from "@tanstack/react-router"; -import { verifyLogin } from "../../../utils/api/auth"; -import { Storages } from "../../../pages/Storages"; - -export const Route = createFileRoute("/app/_hiddenLayout/storages")({ - beforeLoad: async () => { - await verifyLogin(); - }, - component: RouteComponent, -}); - -function RouteComponent() { - return ; -} diff --git a/frontend/src/routes/app/_hiddenLayout/view-product.tsx b/frontend/src/routes/app/_hiddenLayout/view-product.tsx deleted file mode 100644 index 8dbad97..0000000 --- a/frontend/src/routes/app/_hiddenLayout/view-product.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from "@tanstack/react-router"; -import { z } from "zod"; -import { verifyLogin } from "../../../utils/api/auth"; -import { ViewProduct } from "../../../pages/ViewProduct"; - -export const Route = createFileRoute("/app/_hiddenLayout/view-product")({ - beforeLoad: async () => { - await verifyLogin(); - }, - validateSearch: z.object({ - product: z.string(), - }), - component: RouteComponent, -}); - -function RouteComponent() { - const { product } = Route.useSearch(); - return ; -}