
export async function POST(request: any) {
    const data = await request.json();
    try {
      const url = process.env.ZAPIER_URL as string;
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify(data),
      });
      const formattedresponse = await response.json();
      console.log(formattedresponse, "respnzcmsad");
      if (response.ok) {
        return new Response(JSON.stringify({ success: true }), {
          status: 200,
          headers: { "Content-Type": "application/json" }
        });
      } else {
        return new Response(JSON.stringify({ success: false }), {
          status: 500,
          headers: { "Content-Type": "application/json" }
        });
      }
    } catch (error: any) {
      return new Response(JSON.stringify({ success: false, error: error.message }), {
        status: 500,
        headers: { "Content-Type": "application/json" }
      });
    }
  }