首页 > 解决方案 > 检查调用未捕获:参数 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);
   });

标签: javascriptreactjsreduxredux-saga

解决方案


推荐阅读