Angular Interceptor route to a different path based on response
I'm playing around with Angular interceptor and i wanted to re route if the response status is 401 and below is what i've tried . @Injectable() export class AuthInterceptorService implements HttpInterceptor { constructor(private _localStorageService: LocalStorageService, private _router: Router, private _location: Location) { } intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { if (req.url.includes("/login")) { return next.handle(req); } let authToken: LocalStorage = this._localStorageService.getItem('auth-token'); if (authToken) { return next.handle( req.clone({