How to properly chain rxjs 6 observables?

前端 未结 3 1066
囚心锁ツ
囚心锁ツ 2021-01-12 17:40

Any suggestions, how this can be rewritten in more promise-chaining style?:

this.apiService.sendPutRequest(\'/api/users/activate\', usrObj).pipe(
        map         


        
3条回答
  •  旧时难觅i
    2021-01-12 18:26

    use SwitchMap for that.

    mainApiCall.pipe(
        switchMap(result=>secondApiCall(result)),
        switchMap(resultFromSecondApiCall=>thirdApiCall(resultFromSecond))
    ...
    and so on
    )
    

提交回复
热议问题