I want to make an post request to my BackEnd ASP.NET Core Web API from my React JS FrontEnd but when using @axios@ it is not triggered.
I followed some instructions from the internet regarding making an axios get/post request but it seemed not to work
handleRegistration = (event) => {
event.preventDefault();
const user = {
email: this.state.email,
firstName: this.state.firstName,
lastName: this.state.lastName,
password: this.state.password
};
axios.post('http://localhost:{somenumbershere}/api/values', { user })
.then(res => {
console.log(res);
console.log(res.data);
})
}
I am creating a user and want to send him as an object to my Action method to the BackEnd but it never hits the breakpoint. As you see the url I am sending my obj to, the @api/values/5@ is an example route for sending to the backend actiom method. I have decorated the Action with HttpPost, but still nothing.