This commit is contained in:
hailin 2025-03-14 20:38:51 +08:00
parent fa76cf38dd
commit 06f845d841
1 changed files with 16 additions and 3 deletions

View File

@ -90,7 +90,7 @@ export function MixSignUp(props: {
const signUpWithCode = async (username: string, password: string) => {
console.log("-------------", username)
console.log("-------------username---------", username, "-------------password---------", password);
if (
isLoading ||
@ -108,7 +108,7 @@ export function MixSignUp(props: {
}).then(function (result: any) {
setIsLoading(false);
console.log("result:", result)
console.log("==================> result:", result)
if (result && result.header.code != 0) {
@ -129,7 +129,20 @@ export function MixSignUp(props: {
});
} catch (error) {
setIsLoading(false);
console.error(error);
// 更详细的错误信息
if (err.response) {
// 如果是网络请求返回的错误(如 4xx 或 5xx 错误)
console.error("Response Error:", err.response);
toast.error(`API 错误: ${err.response.status} - ${err.response.data.message || '未知错误'}`);
} else if (err.request) {
// 如果请求没有响应
console.error("Request Error:", err.request);
toast.error("请求超时或无法连接到服务器");
} else {
// 其他错误(如代码错误)
console.error("General Error:", err.message);
toast.error(`发生了一个错误: ${err.message}`);
}
}
};