import { NextRequest, NextResponse } from "next/server";

import { clearAuthCookie } from "@/lib/server/hermes";
import { assertSameOrigin } from "@/lib/server/request-guards";

export async function POST(request: NextRequest) {
  const originError = assertSameOrigin(request);

  if (originError) {
    return originError;
  }

  const response = NextResponse.json({ ok: true });

  clearAuthCookie(response);

  return response;
}
