19 lines
416 B
TypeScript
19 lines
416 B
TypeScript
import { Outlet, redirect, createFileRoute } from "@tanstack/react-router";
|
|
|
|
export const Route = createFileRoute("/_authed/admin")({
|
|
component: Outlet,
|
|
beforeLoad: ({ context }) => {
|
|
if (!context.auth?.roles?.includes("Admin")) {
|
|
throw redirect({ to: "/" });
|
|
}
|
|
|
|
return {
|
|
header: {
|
|
...context.header,
|
|
title: "Admin",
|
|
withBackButton: true,
|
|
},
|
|
};
|
|
},
|
|
});
|