Revision 59967
Added by Konstantinos Triantafyllou over 3 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/error-interceptor.service.ts | ||
---|---|---|
7 | 7 |
import {LoginErrorCodes} from "./login/utils/guardHelper.class"; |
8 | 8 |
import {properties} from "../../environments/environment"; |
9 | 9 |
import {isArray} from "util"; |
10 |
import {element} from "@angular/core/src/render3"; |
|
11 | 10 |
|
12 | 11 |
@Injectable() |
13 | 12 |
export class ErrorInterceptorService implements HttpInterceptor { |
... | ... | |
20 | 19 |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { |
21 | 20 |
return next.handle(req).pipe(catchError(err => { |
22 | 21 |
if ((err.status === 0 && this.isService(req, properties.registryUrl)) || |
23 |
(err.status === 401 && !this.isService(req, ErrorInterceptorService.UNAUTHORIZED_WHITELIST)) || err.status === 403) {
|
|
22 |
(err.status === 401 && !this.isService(req, ErrorInterceptorService.UNAUTHORIZED_WHITELIST))) { |
|
24 | 23 |
this.logOut(); |
24 |
} else if(err.status === 403) { |
|
25 |
this.unauthorized(); |
|
25 | 26 |
} |
26 | 27 |
return throwError(err); |
27 | 28 |
})); |
... | ... | |
44 | 45 |
} |
45 | 46 |
}); |
46 | 47 |
} |
48 |
|
|
49 |
unauthorized() { |
|
50 |
this.router.navigate(['/user-info'], { |
|
51 |
queryParams: { |
|
52 |
'errorCode': LoginErrorCodes.NOT_AUTHORIZED, |
|
53 |
'redirectUrl': this.router.url |
|
54 |
} |
|
55 |
}); |
|
56 |
} |
|
47 | 57 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/sharedComponents/navigationBar.component.html | ||
---|---|---|
7 | 7 |
</a> |
8 | 8 |
</div> |
9 | 9 |
<div class="tm-header-mobile uk-hidden@m"> |
10 |
<nav class="uk-navbar-container uk-navbar" uk-navbar=""> |
|
10 |
<nav class="uk-navbar-container uk-navbar" uk-navbar="" [class.uk-navbar-transparent]="header.stickyAnimation === false">
|
|
11 | 11 |
<div *ngIf="(properties.environment =='beta' || properties.environment =='development') && showLogo && header.badge" |
12 | 12 |
class="uk-position-top-left"> |
13 | 13 |
<img class="small-beta-indication" |
Also available in: Unified diff
[Library | Trunk]: Fix error interceptor to logout only in 401. Fix navbar on mobiles to be transparent