SHARE
TWEET

Untitled

a guest Dec 10th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. intercept(observable: Observable<Response>): Observable<Response> {
  2.         return observable
  3.         .map(response => {
  4.             if (response.url.endsWith('/login')) {
  5.                 window.location.assign('/dsg/login?expired=true');
  6.                 return Observable.empty();
  7.             }
  8.             return response;
  9.         })
  10.         .catch(error => {
  11.             if (error.status == 302 ||
  12.                 error.status == 401 && !error.url.endsWith('/login')) {
  13.                 window.location.assign('/dsg/login');
  14.                 return Observable.empty();
  15.             } else if (error.status == 500 || error.status == 422) {
  16.                 this.exceptionObservable.notifyObservers(error);
  17.             }
  18.             return Observable.throw(error);
  19.         });
  20.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top