// my attempt to submit the form
// this returns with 400
const handleSubmit = (event) => {
event.preventDefault();
// Create a FormData object to mimic the form submission as it is without React
const formData = new FormData();
formData.append('p_0xxxxxxxxxxxxxxxxxxxx2', "");
formData.append('new_name', firstName);
formData.append('new_email', email);
// Post data as form-data content type
fetch('https://my-domain.kinde.com/widgets/subscribe/v1/subscribe', {
method: 'POST',
body: formData,
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
};
// my attempt to submit the form
// this returns with 400
const handleSubmit = (event) => {
event.preventDefault();
// Create a FormData object to mimic the form submission as it is without React
const formData = new FormData();
formData.append('p_0xxxxxxxxxxxxxxxxxxxx2', "");
formData.append('new_name', firstName);
formData.append('new_email', email);
// Post data as form-data content type
fetch('https://my-domain.kinde.com/widgets/subscribe/v1/subscribe', {
method: 'POST',
body: formData,
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
};