Guest User

Untitled

a guest
Jun 26th, 2019
75
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var appURL = '';
  2. appURL = serverURL + $backendApis[apiName] + "/?_s=" + $http.defaults.headers.common['Session-Alias'];
  3.  
  4. return $http.post(appURL, postParams).success(function(response, status, headers, config) {
  5.  
  6. $http.defaults.headers.common['Custom-Access-Token'] = headers('Custom-Access-Token');
  7. if (response.errorCode && response.errorCode != "8233" && response.errorCode != "506717") {
  8. alert("Sorry, we are not able to provide you a quotation at this stage as we are facing a technical issue. Please get back after sometime to issue a quotation or call us. Sorry for the inconvenience");
  9. }
  10. });
  11.  
  12. var promises = urls(); //all your urls in an array
  13.  
  14. function doCall(){
  15.  
  16. var appUrl = promises.pop();
  17. $http.post(appURL, postParams).success(function(response, status, headers, config) {
  18.  
  19. $http.defaults.headers.common['Custom-Access-Token'] = headers('Custom-Access-Token');
  20. if (response.errorCode && response.errorCode != "8233" && response.errorCode != "506717") {
  21. alert("Sorry, we are not able to provide you a quotation at this stage as we are facing a technical issue. Please get back after sometime to issue a quotation or call us. Sorry for the inconvenience");
  22. }
  23. }).then(function(){
  24. if(!promises.length) //no urls left, kill the process.
  25. return;
  26.  
  27. doCalls(); //go ahead for the next one
  28. });
  29. }
RAW Paste Data