Angular concatMap not calling next API

97 Views Asked by At

I am trying to make sequential http calls but the next function (i.e. getGroups) is not called.

These are my function signatures:

getTokenForGroups() : Observable<any>
getGroups() : Observable<any> // is not called

I've checked getTokenForGroups gets called, but my second function isn't.

let grps = []
this.getTokenForGroups().pipe(
    concatMap(tokenResult => {
      console.log(tokenResult);
      return this.getGroups(userId, tokenResult.token)
    }),
    tap(res => console.log("tap2, group result", res)),
  ).subscribe(groups => {
    grps = groups.value as string[];
    console.log(grps)
  }, error => {
    console.log(error);
  });
0

There are 0 best solutions below