I have a simple effect which calls an API to get data and after I get the data, I dispatch an action to save the data in store. I would like to do another action or operation based on the action request. Is that possible?
loadMoviesById$ = createEffect(() => this.actions$.pipe(
ofType('[Movies Page] Load Movies'),
mergeMap((action) => this.moviesService.getAll(action.id)
.pipe(
map(movies => ({ type: '[Movies API] Movies Loaded Success', payload: movies })),
catchError(() => EMPTY)
)),
tap((action) => {
console.log(action.id) //How can I get action.id without passing with loaded success
})
)
);
I am looking to pass the action. id to the tap parameter which is a request parameter for the movies