I am trying to merge similar effects into one, but I'm not sure how to do it.
Below are the effects I have (I need to pass different id
depending on the action type):
setTopics$ = createEffect(
() => this.actions$.pipe(
ofType(setTopics),
map((action) =>
this.service.set(action.payload.id))),
{ dispatch: false });
setHeadlines$ = createEffect(
() => this.actions$.pipe(
ofType(setHeadlines),
map((action) =>
this.service.set(`ldb:${action.payload.id}:0`))),
{ dispatch: false });
I attempted to combine actions using ofType(setTopics,setHeadlines)
, but I'm unsure how to pass different ids in this.service.set()
.
Any help would be greatly appreciated!