In my project, I am utilizing ngrx/effects. The goal is to dispatch different actions depending on the value of a foo
state in the store.
This is my current approach:
@Effect() foo1$ = this.updates$
.whenAction(Actions.FOO)
.filter(obj => !obj.state.product.foo)
.map<string>(toPayload)
.map(x => ({ type: Actions.BAR1, payload: { x }}));
@Effect() foo2$ = this.updates$
.whenAction(Actions.FOO)
.filter(obj => obj.state.product.foo)
.map<string>(toPayload)
.map(x => ({ type: Actions.BAR2, payload: { x }}));
Is there a way to utilize RxJS 5 operators such as partition
, groupBy
, if
, case
following the example in this post? For some reason, I am having trouble implementing them effectively at the moment.