Nested http requests in map


I wrote something like an interceptor which recognizes a session expired and make a relogin to make the http call.
So when I call readPersons I want to detect the session expired and make a relogin and then call the readPersons again. So the readPersons function in PersonPage should get the answer after the second backend call readPersons.
But this not works.

Here is my PersonPage…

        success => this.handleSuccess(success),
        error => {

Here is the backendService…
My backend returns 303 when session expired.

    return this.http.get(PERSONS_URL)

  private handleSuccess() {
    if (res.status === 303) {
      return _this.loginService.login().map(() =>{
            return _this.http.get(PERSONS_URL);

    return res.json() || {};

Not exactly an answer, but I was surprised to see your code. if you didn’t know, Angular has interceptors.

Yeah it is not an interceptor. It is either nested http requests with map.