[CORD-2827] Fixed unauthorized error handling
Change-Id: I6ddef7f869c17db4d8479f23f6e8734f6002d8fc
diff --git a/src/interceptors.ts b/src/interceptors.ts
index 7473226..616063b 100644
--- a/src/interceptors.ts
+++ b/src/interceptors.ts
@@ -26,13 +26,17 @@
export function userStatusInterceptor($state: angular.ui.IStateService, $cookies: ng.cookies.ICookiesService, $q: ng.IQService) {
const checkLogin = (res) => {
+
+ // NOTE canceled request (as the modeldefs one) have no res
+ if (angular.isUndefined(res) || res === null) {
+ return $q.reject(res);
+ }
+
// NOTE this interceptor may never be called as the request is not rejected byt the "model-discoverer" service
switch (res.status) {
- case -1:
case 401:
case 403:
$cookies.remove('sessionid', {path: '/'});
- $state.go('login');
return $q.reject(res);
default:
return $q.reject(res);