【发布时间】:2021-08-16 10:46:26
【问题描述】:
我试图自己找出问题所在,但试图找出问题的 a$$ 一直很痛苦。我正在使用 axios 并且不知道似乎是什么导致了问题。 (我是 ReactJS 的新手)下面我发布了一个屏幕截图,如果它会让您更容易确定问题。 enter image description here
export const actFetchMealsRequest = () => {
return (dispatch) => {
return callApi('/Product', 'GET', null).then(res => {
dispatch(GetAllMeal(res.data));
});
}
}
/*GET_ALL_MEAL*/
export function GetAllMeal(payload){
return{
type:'GET_ALL_MEAL',
payload
}
}
【问题讨论】:
-
它说你
res是 undefined 。而你正在尝试做undefined.data。你能添加你的callApi的代码吗? -
我能够在callApi中解决问题,谢谢。 :)