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; }