PixelBoii

Untitled

Nov 14th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. else if (request.priceSource == 'getItemsInstant') {
  2. var url = "https://csgoempire.com/api/v2/p2p/inventory/instant";
  3.  
  4. fetch(url)
  5. .then(res => res.json())
  6. .then(items => {
  7. var itemsList = [];
  8. var addExtra = 0;
  9. var bundle = 0;
  10. user_sort(items, request.sortingMethod, request.sortingType);
  11.  
  12. for (i = ((request.page - 1) * 50); i < addExtra + ((request.page - 1) * 50) + 50; i++) {
  13. if (bundle == items[i].bundle_id) {
  14. addExtra += 1;
  15. }
  16.  
  17. itemsList.push(items[i].market_name);
  18. bundle = items[i].bundle_id;
  19. }
  20. sendResponse(itemsList);
  21. })
  22. .catch(err => { throw err });
  23. return true; // Will respond asynchronously.
  24. }
Add Comment
Please, Sign In to add comment