significant refactor
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import { Outlet, redirect, createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute('/_authed/admin')({
|
||||
export const Route = createFileRoute("/_authed/admin")({
|
||||
component: Outlet,
|
||||
beforeLoad: ({ context }) => {
|
||||
if (!context.auth?.roles?.includes('Admin')) {
|
||||
throw redirect({ to: '/' })
|
||||
if (!context.auth?.roles?.includes("Admin")) {
|
||||
throw redirect({ to: "/" });
|
||||
}
|
||||
|
||||
return {
|
||||
header: {
|
||||
...context.header,
|
||||
title: 'Admin',
|
||||
withBackButton: true
|
||||
title: "Admin",
|
||||
withBackButton: true,
|
||||
},
|
||||
};
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user