I have the need to use vue-resource to obtain multiple JSONs that basically are the same only as there are many elements the API is limited to consume only 1000 records, but I want to collect all of them in the same object, so I made a small loop to consume the API based on the record counter that returns:
created(){
this.$http.get('/api/transactions?senderId=8642612272713533685S&limit=1&offset=000')
.then( function(res){
console.log(res.body.count);
let limit = Math.ceil(res.body.count/1000);
console.log(limit);
let m = {};
let off = 0;
for (var i = 0; i <= limit; i++) {
this.$http.get('/api/transactions?senderId=8642612272713533685S&limit=1000', {params:{offset: off}})
.then( function(data){
this.lista = { ...this.lista, ...data.body.transactions }
} )
off = off + 1000;
}
}
);
}
But in the end this.list does not return the combination of all transactions, does anyone know how to solve it?