Compare commits

...

2 Commits

Author SHA1 Message Date
Esteban Paz b41afa6c98 Merge pull request 'add send email' (#14) from email-form-contact into main
Reviewed-on: #14
2026-02-22 12:11:36 +00:00
David Ascanio 7d6bcdf2cb add send email 2026-02-22 09:09:17 -03:00
2 changed files with 27 additions and 1 deletions

3
.gitignore vendored
View File

@ -23,4 +23,5 @@ pnpm-debug.log*
.idea/
/generated/prisma
/prisma/*.db
/prisma/*.db
prisma/dev.db

View File

@ -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,