Angular 12 ConcatMap 我该怎么做?

Angular 12 ConcatMap how i can do it?

我想连接两个 api 电话。我如何在此代码上使用 ConcatMap?

    getHIndices(code) {

        
        this.api.getInstrumentHistoryIndices(code, '3M')
            .subscribe((response: {}) => {
                this.prepareDataForHistory(response);
            });

        setTimeout(() => {
            this.api.getInstrumentHistoryIndices(code, '5Y')
            .subscribe((response: {}) => {
                this.prepareDataForHistory2(response);
            });
        }, 300);

    }

尝试以下操作:

getHIndices(code) {
  this.api
    .getInstrumentHistoryIndices(code, '3M')
    .pipe(
      tap(response1 => {
        this.prepareDataForHistory(response1);
      }),
      concatMap(() => this.api.getInstrumentHistoryIndices(code, '5Y'))
    )
    .subscribe(response2 => {
      this.prepareDataForHistory2(response2);
    });
}