From 9ef6025aacefbee7bb457563df0ec28ab2698803 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Fri, 31 May 2019 13:18:47 -0400 Subject: fix http intercept handler - was not returning errors correctly, resulting in 4xx returning in success --- www/js/app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index 18bead17..90dfe96a 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -667,7 +667,7 @@ angular.module('zmApp', [ } - return config; + return config || $q.when(config); }, responseError: function (rejection) { @@ -682,7 +682,7 @@ angular.module('zmApp', [ console.log ("MESSAGE:"+rejection.data.data.message); if (rejection.data.data.message.indexOf('API Disabled') != -1) { $rootScope.apiValid = false; - return rejection; + return $q.reject(rejection); } } @@ -700,12 +700,12 @@ angular.module('zmApp', [ return $injector.get('$http')(rejection.config); }, function (err) { nvr.log ("Interception proceedWithLogin failed, NOT retrying old request"); - return err; + return $q.reject(err); }); } else { if (rejection.config.skipIntercept) nvr.log ("Not intercepting as skipIntercept true"); - return rejection; + return $q.reject(rejection); } }, @@ -737,7 +737,7 @@ angular.module('zmApp', [ // console.log ("FIXED="+JSON.stringify(response.data)); } //"data":"
-        return response;
+        return response || $q.when(response);
       }
 
     };
-- 
cgit v1.2.3