[错误:呼叫:类型{context,fn}的参数未定义或null`fn`]
我在应用程序中使用Saga Redux,当我尝试向我的API请求时,我会遇到以下错误,
èrro [Error:call: argument of type {context,fn} has undefined or null `fn`] -- > and
<< -- --> Possible unhandled Promise rejection (id:0).
try {
const date = yield call(cloudfy.requestExtractList(), {
DadosConta,
});
console.log('test', date);
yield put(ActionCreators.requestExtractList(response.data));
} catch (error) {
console.log(error);
}
如果我在requestExtractList上删除(),则触发错误响应 const date =收益呼叫(cloudfy.requestextractList,{adosconta,})
>
I'm using saga redux in my application, and I'm getting the following error when I try to make a request to my api the error is:
èrro [Error:call: argument of type {context,fn} has undefined or null `fn`] -- > and
<< -- --> Possible unhandled Promise rejection (id:0).
try {
const date = yield call(cloudfy.requestExtractList(), {
DadosConta,
});
console.log('test', date);
yield put(ActionCreators.requestExtractList(response.data));
} catch (error) {
console.log(error);
}
Fires error response if I remove the () at requestExtractListconst date = yield call(cloudfy.requestExtractList, { DadosConta, })
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定
requestExtractList
是否需要cloudfy
上下文,如果是这样,请尝试:如果您再次获得错误响应,则该问题在您发送到端点的数据中,而不是传奇API。
此外,如果您仅调用一个普通功能,则不一定需要使用
呼叫
效果。传奇的产量可以直接处理承诺。因此,您可以做:Not sure if
requestExtractList
needs thecloudfy
context, if so try:If you again get an error reponse it means the problem is in the data you send to the endpoint, not the saga api.
Additionally, if you are calling just a normal function you don't necessarily need to use the
call
effect. Saga's yield can handle promises directly. So you can do just: