1(function (window, angular) { 2 'use strict'; 3 4 angular 5 .module('RFPe') 6 .factory('httpLoader', HttpLoader); 7 8 /* 9 * HttpLoader 10 * - Interceptador exibe o gif de loading enquanto houver requisições HTTP 11 */ 12 HttpLoader.$inject = ['$rootScope', '$q']; 13 function HttpLoader($rootScope, $q) { 14 var requests = 0; 15 return { 16 request: function (config) { 17 requests++; 18 if (config.loader === undefined || config.loader) { 19 $rootScope.$broadcast("loader_show"); 20 } 21 return config || $q.when(config); 22 }, 23 response: function (response) { 24 if ((--requests) === 0) { 25 $rootScope.$broadcast("loader_hide"); 26 } 27 return response || $q.when(response); 28 }, 29 responseError: function (response) { 30 if (!(--requests)) { 31 $rootScope.$broadcast("loader_hide"); 32 } 33 var page =document.location.href.substring( document.location.href.lastIndexOf('/')+1); 34 if (page !== 'login.html'){ 35 if (response.status === 401 || response.status === '401'){ 36 delete sessionStorage.token; 37 document.location.href = 'login.html'; 38 } 39 } 40 return $q.reject(response); 41 } 42 }; 43 } 44 45})(window, angular);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.