init
This commit is contained in:
18
src/app/routes/_authed/admin.tsx
Normal file
18
src/app/routes/_authed/admin.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
},
|
||||
};
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user