Reputation: 6619
I'm trying to send a post using axios from React into a webapi controller post action. I can see my post action hit, but when I look at the parameter object it has the normal properties but they're all null or 0. I've converted the post params into json string before sending and that has started to at least get me the parameter object's properties but they just go to their defaults.
const params = JSON.stringify({UserID, Configurations{}, ViewName});
axios.post("<path to api>", params);
public void Post([FromBody]UserConfigurationModel Model){
... }
Upvotes: 0
Views: 776
Reputation: 5927
Try passing your object as is, without stringify'ing it:
const params = {UserID, Configurations, ViewName};
axios.post("<path to api>", params);
Upvotes: 1