Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var appURL = '';
- appURL = serverURL + $backendApis[apiName] + "/?_s=" + $http.defaults.headers.common['Session-Alias'];
- return $http.post(appURL, postParams).success(function(response, status, headers, config) {
- $http.defaults.headers.common['Custom-Access-Token'] = headers('Custom-Access-Token');
- if (response.errorCode && response.errorCode != "8233" && response.errorCode != "506717") {
- 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");
- }
- });
- var promises = urls(); //all your urls in an array
- function doCall(){
- var appUrl = promises.pop();
- $http.post(appURL, postParams).success(function(response, status, headers, config) {
- $http.defaults.headers.common['Custom-Access-Token'] = headers('Custom-Access-Token');
- if (response.errorCode && response.errorCode != "8233" && response.errorCode != "506717") {
- 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");
- }
- }).then(function(){
- if(!promises.length) //no urls left, kill the process.
- return;
- doCalls(); //go ahead for the next one
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement