Skip to content

Commit a529088

Browse files
committed
feedback
1 parent 52c5100 commit a529088

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

src/pages/feedbackForm.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,14 @@ export default function feedbackForm() {
3131

3232
console.log(name, email, feedback);
3333

34-
const filteredFormData = Object.fromEntries(
35-
Object.entries(formData).filter(([key, value]) => value.trim() !== "")
36-
);
37-
38-
Object.entries(filteredFormData).forEach(([key, value]) => {
39-
baseurl += `&entry.${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
40-
});
41-
4234
console.log(baseurl);
35+
const urlEncodedFormData = new URLSearchParams(formData).toString();
36+
4337
const response = await fetch(baseurl, {
4438
method: "POST",
45-
body: JSON.stringify({ data: 1, formData }),
39+
body: urlEncodedFormData,
4640
headers: {
47-
"Content-Type": "application/json",
41+
"Content-Type": "application/x-www-form-urlencoded",
4842
},
4943
});
5044

0 commit comments

Comments
 (0)