Preventing to visit the login page if the user is logged in
Change-Id: I7e3fe159300e4a29b3b9f5203b3bc6438a40148c
diff --git a/src/interceptors.ts b/src/interceptors.ts
index 80be130..273d19e 100644
--- a/src/interceptors.ts
+++ b/src/interceptors.ts
@@ -9,10 +9,13 @@
$resourceProvider.defaults.stripTrailingSlashes = false;
}
-export function userStatusInterceptor($state: angular.ui.IStateService) {
+export function userStatusInterceptor($state: angular.ui.IStateService, $cookies: ng.cookies.ICookiesService) {
const checkLogin = (res) => {
if (res.status === 401 || res.status === -1) {
+ $cookies.remove('xoscsrftoken');
+ $cookies.remove('xossessionid');
+ $cookies.remove('xosuser');
$state.go('login');
}
return res;