From 569753c030acb3c2b84fa6a71b5b4d689b96cef2 Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Thu, 2 Nov 2017 10:33:30 +0200 Subject: [PATCH] - --- dmp-frontend/src/app/services/interceptor.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dmp-frontend/src/app/services/interceptor.ts b/dmp-frontend/src/app/services/interceptor.ts index 9ac5e9d7e..79605bb69 100644 --- a/dmp-frontend/src/app/services/interceptor.ts +++ b/dmp-frontend/src/app/services/interceptor.ts @@ -2,12 +2,12 @@ import {Injectable} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpResponse, HttpErrorResponse} from '@angular/common/http'; import { TokenService, TokenProvider } from './login/token.service'; - +import {Router} from '@angular/router'; @Injectable() export class GlobalInterceptor implements HttpInterceptor { - constructor(public tokenService: TokenService) {} + constructor(public tokenService: TokenService, private router : Router) {} intercept(req: HttpRequest, next: HttpHandler): Observable> { @@ -21,6 +21,7 @@ export class GlobalInterceptor implements HttpInterceptor { if (err instanceof HttpErrorResponse) { if (err.status === 401) { this.tokenService.logout(); + this.router.navigate(['/dmps'], { queryParams: { /*returnUrl: this.state.url*/ }}); } } });