From fc131b5a0d122c31e2bd77edd28a39b2fac5c1d5 Mon Sep 17 00:00:00 2001 From: Witold Szczerba Date: Thu, 17 Nov 2016 16:20:51 +0100 Subject: [PATCH] 1.5.0 --- dist/http-auth-interceptor.js | 6 ++++++ dist/http-auth-interceptor.min.js | 2 +- package.json | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/http-auth-interceptor.js b/dist/http-auth-interceptor.js index 0fd9789..060d8f8 100644 --- a/dist/http-auth-interceptor.js +++ b/dist/http-auth-interceptor.js @@ -5,6 +5,7 @@ * (c) 2012 Witold Szczerba * License: MIT */ + (function () { 'use strict'; @@ -133,3 +134,8 @@ }; }]); })(); + +/* commonjs package manager support (eg componentjs) */ +if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports){ + module.exports = 'http-auth-interceptor'; +} diff --git a/dist/http-auth-interceptor.min.js b/dist/http-auth-interceptor.min.js index 726bbed..167529a 100644 --- a/dist/http-auth-interceptor.min.js +++ b/dist/http-auth-interceptor.min.js @@ -1 +1 @@ -!function(){"use strict";angular.module("http-auth-interceptor",["http-auth-interceptor-buffer"]).factory("authService",["$rootScope","httpBuffer",function($rootScope,httpBuffer){return{loginConfirmed:function(data,configUpdater){var updater=configUpdater||function(config){return config};$rootScope.$broadcast("event:auth-loginConfirmed",data),httpBuffer.retryAll(updater)},loginCancelled:function(data,reason){httpBuffer.rejectAll(reason),$rootScope.$broadcast("event:auth-loginCancelled",data)}}}]).config(["$httpProvider",function($httpProvider){$httpProvider.interceptors.push(["$rootScope","$q","httpBuffer",function($rootScope,$q,httpBuffer){return{responseError:function(rejection){var config=rejection.config||{};if(!config.ignoreAuthModule)switch(rejection.status){case 401:var deferred=$q.defer(),bufferLength=httpBuffer.append(config,deferred);return 1===bufferLength&&$rootScope.$broadcast("event:auth-loginRequired",rejection),deferred.promise;case 403:$rootScope.$broadcast("event:auth-forbidden",rejection)}return $q.reject(rejection)}}}])}]),angular.module("http-auth-interceptor-buffer",[]).factory("httpBuffer",["$injector",function($injector){function retryHttpRequest(config,deferred){function successCallback(response){deferred.resolve(response)}function errorCallback(response){deferred.reject(response)}$http=$http||$injector.get("$http"),$http(config).then(successCallback,errorCallback)}var $http,buffer=[];return{append:function(config,deferred){return buffer.push({config:config,deferred:deferred})},rejectAll:function(reason){if(reason)for(var i=0;i