我目前在我的React本机应用程序中使用redux-cycles来发出API请求。这是我的周期:
const handleAction$ = ACTION
.filter(({ type }) => type === Types.MY_THING)
.map(({ stuff }) => stuff)
.compose(fooBar())
.map(() => ({
url: 'bad_url_for_testing',
method: 'POST',
}))
const continue$ = HTTP
.select('sendStuff')
// check for error
.map(response$ => response$.replaceError(err => xs.of(err.response)))
.flatten()
// choose the correct action
// this is where it fails!
.map((res) =>
res.error
? Creators.failureAction()
: Creators.successAction()
);
return {
HTTP: handleAction$,
ACTION: continue$
}
但是,在运行周期时,我将收到以下错误:
Cannot read property 'error' of undefined
出了什么问题?
预先感谢