I have written below. I tried without adding headers and with headers. I have added the headers in the middlewares in my backed. But I'm still getting the network error. Any suggestions would be helpful
this.data = {
name: this.state.name,
email: this.state.email,
username: this.state.username,
password: this.state.password,
};
this.headers = {
'Content-Type': 'application/json; charset=utf-8',
Accept: 'application/json',
};
Axios.post('http://localhost:8080/api/auth/signup', this.data, this.headers)
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});