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