Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. initData: function(){
  2. const thisApp = this;
  3.  
  4. thisApp.data = [];
  5.  
  6. const url = settings.db.url + '/' + settings.db.product;
  7.  
  8. fetch(url)
  9. .then(function(rawResponse){
  10. return rawResponse.json();
  11. })
  12. .then(function(parsedResponse){
  13. console.log('parsedResponse', parsedResponse);
  14.  
  15. /* save parsedResponse as thisApp.data.products */
  16.  
  17. thisApp.data.products = parsedResponse;
  18.  
  19. /* execute initMenu method */
  20.  
  21. thisApp.initMenu();
  22.  
  23. });
  24.  
  25. console.log('thisApp.data', JSON.stringify(thisApp.data));
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement