Files
lstV2/frontend/src/routes/_auth.tsx

14 lines
353 B
TypeScript

import {createFileRoute, redirect} from "@tanstack/react-router";
// src/routes/_authenticated.tsx
export const Route = createFileRoute("/_auth")({
beforeLoad: async () => {
const auth = localStorage.getItem("auth_token");
if (!auth) {
throw redirect({
to: "/login",
});
}
},
});