I am posting form data to an api using reactjs, I am trying to find out the response so I can put some error handling on my fetch function. My response is as follows, but it is 200:
{}
So how would I put this in a response code?
My submit function is:
handleSubmit(e) {
e.preventDefault();
/*global fetch */
this.setState({ loading: true});
fetch('https://bac1eal279.execute-api.eu-west-2.amazonaws.com/dev',{
method: "POST",
body: JSON.stringify(this.state),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
}).then(
(response) => (response.json())
).then((response)=>{
});
}