10 lines
358 B
TypeScript
10 lines
358 B
TypeScript
export interface ProxyToken {
|
|
rank?: unknown;
|
|
}
|
|
|
|
export function shouldRedirectAdminRequest(pathname: string, token: ProxyToken | null): boolean {
|
|
if (pathname !== "/admin" && !pathname.startsWith("/admin/")) return false;
|
|
const rank = typeof token?.rank === "number" ? token.rank : Number(token?.rank);
|
|
return !Number.isInteger(rank) || rank < 7;
|
|
}
|