我正在使用ngrx/effects.
我怎样才能发出空行动?
这就是我现在正在做的事情:
@Effect() foo$ = this.actions$
.ofType(Actions.FOO)
.withLatestFrom(this.store, (action, state) => ({ action, state }))
.map(({ action, state }) => {
if (state.foo.isCool) {
return { type: Actions.BAR };
} else {
return { type: 'NOT_EXIST' };
}
});
Run Code Online (Sandbox Code Playgroud)
由于我必须返回一个动作,我正在使用return { type: 'NOT_EXIST' };.
有一个更好的方法吗?