【发布时间】:2018-11-19 12:22:53
【问题描述】:
我有一个史诗,可以捕获获取状态的每次调度(只是状态中的项目,例如 state.process:{ status: fail, success, inWork},而不是像 200、500 等的请求状态)。 当状态 == 成功(通过从状态获取状态)时,我需要调度另一个动作,例如 SET_STATUS_SUCCESS
const getStatus = (action, state) =>
action.pipe(
ofType(GET_STATUS),
withLatestFrom(state),
mergeMap(([action, state]) => {
const { status } = state.api.process; //here is what i need, there is no problem with status.
if (status === "success") {
return mapTo(SET_STATUS_SUCCESS) //got nothing and error.
}
})
);
现在我收到错误:
Uncaught TypeError: You provide 'function (source) { return source.lift(新 MapToOperator(值)); }' 需要流的地方。 您可以提供 Observable、Promise、Array 或 Iterable。 在 subscribeTo (subscribeTo.js:41)
我该怎么办?我尝试只返回 setStatusSuccess 操作,但它也不起作用。
【问题讨论】:
标签: rxjs observable redux-observable