且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ngrx/effects中使用/其他?

更新时间:2023-11-17 15:43:34

具有2个单独的效果源就可以了.否则就简单点:

Having 2 separate effect sources are fine. Otherwise make it simple:

@Effect() foo$ = this.updates$
    .whenAction(Actions.FOO)
    .map(({action, state}) => {
        if (state.product.foo) {
            return { type: Actions.CHAT_GET_MESSAGES2, payload: { action.payload }};
        } else {
            return { type: Actions.CHAT_GET_MESSAGES, payload: { action.payload }};
        }
    });