diff --git a/.gitignore b/.gitignore index 7cc608c..8d2f9ec 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ pnpm-debug.log* .idea/ /generated/prisma -/prisma/*.db \ No newline at end of file +/prisma/*.db +prisma/dev.db diff --git a/src/pages/api/emailInfo/send.ts b/src/pages/api/emailInfo/send.ts index 4ba6f16..27f05d3 100644 --- a/src/pages/api/emailInfo/send.ts +++ b/src/pages/api/emailInfo/send.ts @@ -64,6 +64,31 @@ export const POST: APIRoute = async ({ request }) => { }, }); } + const emailApiKey = import.meta.env.EMAIL_API_KEY; + + const emailResponse = await fetch("http://155.138.215.11:3050/email/send", { + method: "POST", + headers: { + "Content-Type": "application/json", + "x-api-key": emailApiKey!, + }, + body: JSON.stringify({ + type: "CENTRO_DEL_REINO_PAZ_Y_JUSTICIA_INFO", + data: { + nombre, + email, + mensaje, + }, + }), + }); + + if (!emailResponse.ok) { + console.error("Error enviando correo"); + return new Response( + JSON.stringify({ error: "Error en servicio de correo" }), + { status: 500 } + ); + } return new Response(null, { status: 302,