I’m trying to learn react so I’m rebuilding the magento2 minicart in react, all seems to be working well apart from I’m having issues submitting the form data if the quantity changes - I’m trying to do this like so:
onChange = (e) => {
this.setState({ qty: e.target.value }, () => {
axios({
headers: {
'Content-Type': 'application/json'
},
method: 'post',
url: '/checkout/sidebar/updateItemQty/',
data: {
item_id: 13,
item_qty: this.state.qty,
form_key: 'KTC30XGNGahjfVmn'
}
});
});
}
On a refresh of the page the basket quantity doesn’t update, when checking how default mangento2 posts the information it seems to be different as you can see on the images - how can I change my code above so it matches the default post if that’s the issue?
Update: changing params to data makes the request 302 and changes the type to HTML and can't seem to get it back to json