Reputation: 3
I have a problem like this; I want to post two objects at the same time with axios, but I realized that it is not with the following codes. How do you think I can post two objects at the same time?
let companyAry = this.toFormData(this.company[0]);
let productsAry = this.toFormData(this.basket[0]);
axios.post('http://localhost/post', companyAry, productAry)
.then(response => {
console.log(response.data.message);
});
Upvotes: 0
Views: 1411
Reputation: 659
You can combine company and basket objects to one parent object.
let params = {
companyData: companyAry,
productData: productAry
}
let res = await axios.post('your url in here', params);
Upvotes: 1