import { auth } from "@/lib/auth"; import { redirect } from "next/navigation"; import { headers } from "next/headers"; const session = await auth.api.getSession({ headers: await headers(), }); export async function AdminAuthGuard() { if (session?.user.role !== "ADMIN") { return redirect("/login"); } return true; }