Hi so below is my component code where save function has validateData() which has call to api and after the call in store.select is called but not getting the response on the first hit its getting update on second hit and navigatetonext() function takes the response so first time its taking empty object and for second hit it is getting resp if write nagigatetonext funtion inside store.select its getting called multiple times.
save(){
this.cpCommonService.clearErrorDivs();
// this.spinner.show();
if(this.router.url === '/test/details'){
this.ethnicityData();
}else if(this.router.url === '/test/details/member_name'){
this.navigationPath.componentName = "member_name";
this.validateData();
}else{
// this.navigationPath.componentName = "member_ssn";
this.ssnData();
}
this.store.select('data').subscribe(data => {
this.currentPageData = data;
this.isNextClicked = false;
});
this.nextPage(this.currentPageData);
this.store.dispatch(new TestActions.UpdateMembersForm(this.currentPageData['membersForm']['value']));
}
GetPostData$ = this.actions$.pipe(
ofType<TestActions.PostData>(TestActions.POST_DATA),
mergeMap(action =>
this.byhService.navigationDetails(action.payload).pipe(map(resp => {
console.log(resp);
return new TestActions.PostDataSuccess(resp);
}, catchError((error) => of(new TestActions.PostDataError(error))))
)
)
)