Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/Contact/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const Contact: React.FC<ContactProps> = ({ contactFormAccess }) => {
setResult("Sending...");
const formData = new FormData(form);

// Append the API access key dynamically
formData.append("access_key", contactFormAccess);
// Remove the FormData append since we're now using a hidden input
// formData.append("access_key", contactFormAccess);

try {
const response = await fetch("https://api.web3forms.com/submit", {
Expand All @@ -47,6 +47,12 @@ const Contact: React.FC<ContactProps> = ({ contactFormAccess }) => {
return (
<div>
<form onSubmit={onSubmit}>

<input
type="hidden"
name="access_key"
value={contactFormAccess}
/>
<div className="mb-[22px]">
<label
htmlFor="fullName"
Expand Down
4 changes: 2 additions & 2 deletions src/components/Contact/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Form from "./form";

const Contact = () => {
const contactFormAccess = process.env.CONTACT_FORM_ACCESS;
const contactFormAccess = process.env.CONTACT_FORM_ACCESS || "YOUR_WEB3FORMS_ACCESS_KEY_HERE";
return (
<section id="contact" className="relative py-20 md:py-[120px]">
<div className="absolute left-0 top-0 -z-[1] h-full w-full dark:bg-dark"></div>
Expand Down Expand Up @@ -72,7 +72,7 @@ const Contact = () => {
<h3 className="mb-8 text-2xl font-semibold text-dark dark:text-white md:text-[28px] md:leading-[1.42]">
Send us a Message
</h3>
<Form contactFormAccess={contactFormAccess || ""}/>
<Form contactFormAccess={contactFormAccess}/>
</div>
</div>
</div>
Expand Down