javascript - 检查调用未捕获:参数 fn 未定义
问题描述
我在 redux saga 中进行 apis 调用时遇到了这个问题。很快,我删除了这些 api 调用,我没有得到这些错误,但是在我的 saga 中使用这些 api 调用,我得到了这些错误。我不知道为什么会这样。
saga的部分
function* loginUser(action) {
try {
let facebookuser={};
let isNewUserFlag = false;
const photourl =yield call(
getPhoto,
action.socialData.id
);
const facebookuserdata=yield call(
facebookuserdata,
action.socialData.access_token
);
}
the two api calls are
const getPhoto= id =>
axios.get(`https://graph.facebook.com/${id}/picture?type=large`)
.then((response)=>response)
.catch((error)=>{
console.log("getphotoerror",error);
})
const facebookuserdata= id =>
axios.get('https://graph.facebook.com/v2.5/me?fields=email,name,friends&access_token=' + id)
.then((response) => response.json())
.then((json) => {
console.log("facebookuser",json);
})
.catch((error) => {
console.log("facebookuserdataerr",error);
});
解决方案
推荐阅读
- reactjs - How do I clean up my react code by creating a seperate css grid component that is also mobile friendly?
- python - Not able to iterate through QuerySet results with Django
- python - 在 Pandas Dataframe 中复制先前的值
- react-native - 如何在 React Native 中创建拖放嵌套列表
- reactjs - React 应用程序中的权限分配
- bootstrap-4 - 占位符文本更改按钮单击和引导验证单击提交时更改的占位符文本
- vba - 目标搜索基于带有公式的单元格
- html - 表格单元格对齐方式就像在日历中一样
- kubernetes - 使用运行在不同 vps 服务器上的 kubernetes 配置 metallb
- c# - 如何在 ASP.NET Core 的 OData 中导航/配置从复杂类型到实体类型的导航?