Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getRequest() {
- let request = this.$.ajax.generateRequest();
- request.completes.then(req => {
- // returns this.data;
- this.i = 0;
- console.log(this.history); // Logs several objects in array on 1st iteration
- this.getRequest2();
- })
- .catch(rejected => {
- // console.log(rejected.request); // rejected.error
- })
- }
- getRequest2() {
- if (this.i<this.data.length) {
- this.itemId = this.data[this.i].itemId;
- let request = this.$.ajax2.generateRequest();
- request.completes.then(req => {
- this.updateHistory();
- })
- .catch(rejected => {
- // console.log(rejected.request); // rejected.error
- })
- }
- }
- updateHistory() {
- if(typeof this.responseStock.error == 'undefined') {
- this.push('history', {
- "itemId": this.response[0][this.i].itemId,
- "priceNet": this.responseStock.priceNet
- })
- } else {
- this.push('history', {
- "itemId": this.response[0][this.i].itemId,
- "priceNet": null
- })
- }
- this.i = this.i + 1;
- this.getRequest2();
- }
Add Comment
Please, Sign In to add comment