fix(passport): 添加邀请接受接口调试日志
- 在接受邀请请求前打印token和请求URL、参数 - 在请求响应后输出接口响应及返回数据 - 在调用失败时打印错误信息及异常日志 - 保持请求流程和状态管理不变,增强调试能力
This commit is contained in:
@@ -24,5 +24,5 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"lastUpdated": 1775908690098
|
"lastUpdated": 1775909408190
|
||||||
}
|
}
|
||||||
@@ -141,6 +141,10 @@ const InvitePage: React.FC = () => {
|
|||||||
try {
|
try {
|
||||||
setAuthLoading(true);
|
setAuthLoading(true);
|
||||||
|
|
||||||
|
console.log('开始接受邀请, token:', token);
|
||||||
|
console.log('请求URL:', `${INVITE_API_URL}/api/_app/developer/invite/accept`);
|
||||||
|
console.log('请求参数:', { token, code: phoneCode ? '***' : null });
|
||||||
|
|
||||||
const res = await Taro.request({
|
const res = await Taro.request({
|
||||||
url: `${INVITE_API_URL}/api/_app/developer/invite/accept`,
|
url: `${INVITE_API_URL}/api/_app/developer/invite/accept`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -156,6 +160,9 @@ const InvitePage: React.FC = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('接受邀请接口响应:', res);
|
||||||
|
console.log('响应数据:', res.data);
|
||||||
|
|
||||||
if (res.data.code === 200 || res.data.code === 0) {
|
if (res.data.code === 200 || res.data.code === 0) {
|
||||||
Taro.showToast({ title: '加入成功', icon: 'success', duration: 1500 });
|
Taro.showToast({ title: '加入成功', icon: 'success', duration: 1500 });
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -163,9 +170,11 @@ const InvitePage: React.FC = () => {
|
|||||||
Taro.switchTab({ url: '/pages/index/index' });
|
Taro.switchTab({ url: '/pages/index/index' });
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} else {
|
} else {
|
||||||
|
console.error('接受邀请失败:', res.data.message, 'code:', res.data.code);
|
||||||
Taro.showToast({ title: res.data.message || '加入失败', icon: 'none' });
|
Taro.showToast({ title: res.data.message || '加入失败', icon: 'none' });
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
console.error('接受邀请异常:', err);
|
||||||
Taro.showToast({ title: err.message || '加入失败', icon: 'error' });
|
Taro.showToast({ title: err.message || '加入失败', icon: 'error' });
|
||||||
} finally {
|
} finally {
|
||||||
setAuthLoading(false);
|
setAuthLoading(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user