From 30b09b1fcaeb0b6536fcb4ca449d5a9e2d540333 Mon Sep 17 00:00:00 2001 From: Alexander Henderson Date: Tue, 26 Nov 2024 02:22:40 -0500 Subject: [PATCH] fix phone field data --- src/components/ContactForm.vue | 2 +- src/pages/api/contact.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/ContactForm.vue b/src/components/ContactForm.vue index 10042f0..86ba99f 100644 --- a/src/components/ContactForm.vue +++ b/src/components/ContactForm.vue @@ -69,7 +69,7 @@ async function submit(e: Event) { const dataToSend = new FormData(); dataToSend.append('name', formData.value.name); dataToSend.append('email', formData.value.email); - dataToSend.append('phone', formData.value.name); + dataToSend.append('phone', formData.value.phone); dataToSend.append('title', formData.value.title); dataToSend.append('company', formData.value.company); dataToSend.append('message', formData.value.message); diff --git a/src/pages/api/contact.ts b/src/pages/api/contact.ts index 621a4bc..d832b43 100644 --- a/src/pages/api/contact.ts +++ b/src/pages/api/contact.ts @@ -41,7 +41,7 @@ export const POST: APIRoute = async ({ request }) => { if (!turnstileToken) { return new Response( - JSON.stringify({ message: "Turnstile validation token missing." }), + JSON.stringify({ message: "Turnstile validation token missing. C-100" }), { status: 400 } ); } @@ -63,7 +63,7 @@ export const POST: APIRoute = async ({ request }) => { if (!verifyData.success) { return new Response( - JSON.stringify({ message: "Turnstile verification failed." }), + JSON.stringify({ message: "Turnstile verification failed. C-101" }), { status: 400 } ); } @@ -86,7 +86,7 @@ export const POST: APIRoute = async ({ request }) => { // Validate that all fields are provided if (!name || !email || !message) { return new Response( - JSON.stringify({ message: "Missing required fields" }), + JSON.stringify({ message: "Missing required fields." }), { status: 400 } ); } @@ -191,7 +191,7 @@ export const POST: APIRoute = async ({ request }) => { console.error("Failed to send email:", error); return new Response( JSON.stringify({ - message: "Failed to send email", + message: "Failed to send email.", error: error.message, }), { status: 500 }