[CORD-989] Login errors
Change-Id: I781f3535110664d4b1de2659f6995102949ffb8c
diff --git a/src/interceptors.ts b/src/interceptors.ts
index 1ba6423..0a2bf74 100644
--- a/src/interceptors.ts
+++ b/src/interceptors.ts
@@ -1,19 +1,17 @@
/// <reference path="../typings/index.d.ts" />
-// TODO handle backend failure
-
export function interceptorConfig($httpProvider: angular.IHttpProvider, $resourceProvider: angular.resource.IResourceServiceProvider) {
$httpProvider.interceptors.push('UserStatusInterceptor');
$httpProvider.interceptors.push('CredentialsInterceptor');
$httpProvider.interceptors.push('NoHyperlinksInterceptor');
}
-export function userStatusInterceptor($state: angular.ui.IStateService, $cookies: ng.cookies.ICookiesService) {
-
+export function userStatusInterceptor($state: angular.ui.IStateService, $cookies: ng.cookies.ICookiesService, $q: ng.IQService) {
const checkLogin = (res) => {
if (res.status === 401 || res.status === -1) {
$cookies.remove('sessionid', {path: '/'});
$state.go('login');
+ return $q.reject(res);
}
return res;
};