[CORD-2827] Fixed unauthorized error handling
Change-Id: I6ddef7f869c17db4d8479f23f6e8734f6002d8fc
diff --git a/src/app/datasources/rest/auth.rest.ts b/src/app/datasources/rest/auth.rest.ts
index 2bc2bbc..0c202b0 100644
--- a/src/app/datasources/rest/auth.rest.ts
+++ b/src/app/datasources/rest/auth.rest.ts
@@ -46,7 +46,7 @@
getUser(): any; // NOTE how to define return user || false ???
isAuthenticated(): boolean;
clearUser(): void;
- handleUnauthenticatedRequest(error: IXosRestError | string): void;
+ isAuthError(error: IXosRestError | string): boolean;
}
export class AuthService {
@@ -111,7 +111,7 @@
return angular.isDefined(session);
}
- public handleUnauthenticatedRequest(res: IXosRestError | string): void {
+ public isAuthError(res: IXosRestError | string): boolean {
let err;
if (angular.isString(res)) {
try {
@@ -129,9 +129,7 @@
if (err && err.error) {
switch (err.error) {
case 'XOSPermissionDenied':
- this.clearUser();
- this.$state.go('login');
- break;
+ return true;
}
}
}