You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.
But I want it to have a client-side validation & so I used FormData. If you don't know what FormData is & never heard about it (I didn't) it works like Form but through JavaScript rather than HTML.
I am using React & I implemented something like this -
Everything is same, just implemented in React using this CodePen as inspiration but still it doesn't work
If I use method as GET I get TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body which is true. So I make method as POST & I get 404: Not Found since that route doesn't exist.
So why do I need this? To perform client-side validation & embedding it on a single-page application like React or Gatsby. Also, if an API can be provided, it'd be awesome :)
How do I solve this?
The text was updated successfully, but these errors were encountered:
The route your posting at only accept GET method, that's why you get a 404. If you want to post new subscribers according to the route file for the lists you should post at /api/list/add/subscribers :
// Post new subscribers
app.post('/api/list/add/subscribers', apiIsAuth, writeListAccess, (req, res) => {
addSubscribers(req, res);
});
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have basically this form
But I want it to have a client-side validation & so I used FormData. If you don't know what
FormData
is & never heard about it (I didn't) it works like Form but through JavaScript rather than HTML.I am using React & I implemented something like this -
Everything is same, just implemented in React using this CodePen as inspiration but still it doesn't work
If I use
method
asGET
I getTypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body
which is true. So I makemethod
asPOST
& I get404: Not Found
since that route doesn't exist.So why do I need this? To perform client-side validation & embedding it on a single-page application like React or Gatsby. Also, if an API can be provided, it'd be awesome :)
How do I solve this?
The text was updated successfully, but these errors were encountered: