export const prerender = false;

import type { APIRoute } from 'astro';
import { ADMIN_COOKIE } from '@admin/lib/admin-auth';

export const POST: APIRoute = ({ cookies }) => {
  // Delete both possible paths to handle old cookies (path=/admin) and new (path=/)
  cookies.delete(ADMIN_COOKIE, { path: '/' });
  cookies.delete(ADMIN_COOKIE, { path: '/admin' });
  return new Response(null, {
    status: 302,
    headers: { Location: '/admin/login' },
  });
};
