refactor: outsource auth function in all routes

This commit is contained in:
2026-07-10 11:17:31 +02:00
parent ef5fb3e1da
commit 3153076d72
8 changed files with 105 additions and 107 deletions
@@ -1,14 +1,10 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import { isAuthenticated } from "../../../utils/api/auth";
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 () => {
if (!(await isAuthenticated())) {
throw redirect({
to: "/login",
});
}
await verifyLogin();
},
component: RouteComponent,
});