Uncaught Promise in Axios Post to Web Api


#1

I am working on an asp.net core project that is using Vue on the frontend. I have an update form that successfully performs an Axios get call to get a single record to update. The url contains two parameters in the querystring that are used in the Axios get call. Everything works great until you save the changes and perform a Axios post call to the api. The data is successful in getting to the api and performing the necessary methods. When the Api sends back a successful 201 Create nothing happens in the Axios promise then response. Also my querystring parameters are not retained in the url. Postman does return a 201

How can I get a successful response in Axios and retain my querystring values in the URL?

URL
https://localhost:44300/StoreAccounts/Edit?userId=123456&accountType=Active
Axios Post
axios.post(’/api/storeBuyer’, this.buyerProfileDto)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});

Web Api Return
return Created($"api/storeBuyer/{buyerProfileDto.ApplicationUserDto.Id}", buyerProfileDto);

Thanks in advance
Brad


#2

Solved. It was causing a postback since I the vue app inside a form tag. Removed form tag, it works just fine. An overlook that I should of seen a long time ago. Duh