Angular: Nested http call with ngrx

In angular I want to convert this nested http calls in ngrx pattern. But how can I do it? I thought to create one action related to getUser and one to getPost. But I can’t understand how can I pass the getUser response as a parameter to getPost function…

ngOnInit() {  
  this.http.get('localhost:8080/api/user').subscribe ( user => {
   let headers = new HttpHeaders({
                   'userId' : user.id
                });

   this.http.get('localhost:8080/api/posts', {headers}).subscribe( posts =>
                this.posts = posts;
               )

 })
}
%d bloggers like this: