Reputation: 7128
I have such data:
links
closures
closures
as of an array at once.axios.post('/api/valChanger', {[val]: e})
.then(res => {
this.closures = res.data.data.links.closures;
})
.catch(error => {
//...
});
Any idea?
Upvotes: 0
Views: 33
Reputation: 14904
Use the rest operator for this case:
axios.post('/api/valChanger', {[val]: e})
.then(res => {
let links = res.data.links;
for(let i = 0; i < links.length; i++){
this.closures = [...this.closures, ...links[i].closures]
}
})
.catch(error => {
//...
});
Upvotes: 1