--- import { env } from 'cloudflare:workers'; // prerender=false is load-bearing security: a static route would have NO per-request auth. The guard // runs per request and the redirect is RETURNED so it actually short-circuits the response. export const prerender = false; import Base from '../../layouts/Base.astro'; import AdminApp from '../../components/admin/AdminApp'; import { requireAdmin } from '../../lib/auth'; try { await requireAdmin(Astro.request, env, Astro.cookies); } catch (error) { const name = (error as { name?: string }).name; if (name === 'InvalidSessionError' || name === 'RoleDeniedError') { return Astro.redirect('/admin/login'); } throw error; } ---