Angular 如何返回嵌套订阅?

Angular 如何返回嵌套订阅?,angular,observable,Angular,Observable,我有以下嵌套订阅,需要返回内部订阅。我该怎么做呢 public updateProfiles(){ this.afAuth.idToken.subscribe(idToken=>{ return this.httpClient.post<any>('https:example.com/getData',{ "token": idToken, "np":"hzlNpV1239nOKRTcsVdPG", "cp":

我有以下嵌套订阅,需要返回内部订阅。我该怎么做呢

public updateProfiles(){
    this.afAuth.idToken.subscribe(idToken=>{
      return this.httpClient.post<any>('https:example.com/getData',{
        "token": idToken,
        "np":"hzlNpV1239nOKRTcsVdPG",
        "cp":"M6nKYrSjsnA9v34vfB8oD"
      });
    })

  }
公共更新配置文件(){
这个.afAuth.idToken.subscribe(idToken=>{
返回此.httpClient.post('https:example.com/getData'{
“令牌”:idToken,
“np”:“hzlNpV1239nOKRTcsVdPG”,
“cp”:“M6nKYrSjsnA9v34vfB8oD”
});
})
}

在调用模块中,我希望看到这个.authService.updateProfiles.subscribe(()=>{do something})

你应该让它可以通过管道传输

updateProfiles() {
  this.afAuth.idToken.pipe(
    switchMap(idToken => this.httpClient.post(your stuff))
  ).subscribe(result => console.log(result))
}