Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

Http nested request

$
0
0

@mdline wrote:

Hello,

I make a request and want that only the nested requests are made when the first returns a http status code 303.
My backend returns 303 when session expired and I want that after successfull login the request for fetching person information is made again.
So is it possible to say that the nested request is only made when the request before has status code 303?

  getPersons() {
    return this.http.get(URL_PERSONS).map(res => {
      if (res.status === 303) {
        return res;
      } else {
        return  res.json();
      }
    })
      .flatMap((res) => {
        if (res.status === 303) {
          return this.login();
        }else {
          return res;
        }
      }).flatMap(res => {
        return this.http.get(URL_PERSONS);
      });
  }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>