This repository has been archived by the owner on Feb 11, 2025. It is now read-only.
第十六课:跨域代理 #21
aspirantzhang
started this conversation in
课程专用
Replies: 2 comments 8 replies
-
老师你好 我根据视频P20 第十六课 修改代码后 登录后无法跳转页面 根据我一步步实测 我发现了是老师的公共接口返回的数据与官方实例不一样
// antdpro官方API返回结构
{
succcess:true,
data:{xxx}
}
// 公共接口API返回结构
{
...data // 直接返回展开了的用户数据
} 个人解决方法:
// 修改 app.tsx getInitialState() 方法中的 fetchUserInfo() 方法返回值
// old
const fetchUserInfo = async () => {
try {
const msg = await queryCurrentUser();
return msg.data;
} catch (error) {
history.push(loginPath);
}
return undefined;
};
// new
const fetchUserInfo = async () => {
try {
const data = await queryCurrentUser();
return data;
} catch (error) {
history.push(loginPath);
}
return undefined;
};
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
本节学习手册:https://www.yuque.com/aspirantzhang/antdprov5/vrukd7
本节代码
8df79bb?branch=8df79bb70e887aa7c5ae4ba8bc083ce90531fefd&diff=split
8e3789c?branch=8e3789c8ba4338098abb18982b116ef73352f646&diff=split
注:由于后期补录增加三项修复,所以本节代码有两次提交。
请发与本节课有关的讨论。
Beta Was this translation helpful? Give feedback.
All reactions