Guest User

Untitled

a guest
Jun 25th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. getRequest() {
  2. let request = this.$.ajax.generateRequest();
  3. request.completes.then(req => {
  4. // returns this.data;
  5. this.i = 0;
  6. console.log(this.history); // Logs several objects in array on 1st iteration
  7. this.getRequest2();
  8. })
  9. .catch(rejected => {
  10. // console.log(rejected.request); // rejected.error
  11. })
  12. }
  13.  
  14.  
  15. getRequest2() {
  16. if (this.i<this.data.length) {
  17. this.itemId = this.data[this.i].itemId;
  18. let request = this.$.ajax2.generateRequest();
  19. request.completes.then(req => {
  20. this.updateHistory();
  21. })
  22. .catch(rejected => {
  23. // console.log(rejected.request); // rejected.error
  24. })
  25. }
  26. }
  27.  
  28. updateHistory() {
  29. if(typeof this.responseStock.error == 'undefined') {
  30. this.push('history', {
  31. "itemId": this.response[0][this.i].itemId,
  32. "priceNet": this.responseStock.priceNet
  33. })
  34. } else {
  35. this.push('history', {
  36. "itemId": this.response[0][this.i].itemId,
  37. "priceNet": null
  38. })
  39. }
  40. this.i = this.i + 1;
  41. this.getRequest2();
  42. }
Add Comment
Please, Sign In to add comment