Skip to content

Commit

Permalink
fix phone field data
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandzors committed Nov 26, 2024
1 parent 28d2b74 commit 30b09b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/ContactForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/pages/api/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
);
}
Expand All @@ -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 }
);
}
Expand All @@ -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 }
);
}
Expand Down Expand Up @@ -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 }
Expand Down

0 comments on commit 30b09b1

Please sign in to comment.