This commit is contained in:
parent
fa76cf38dd
commit
06f845d841
|
|
@ -90,7 +90,7 @@ export function MixSignUp(props: {
|
||||||
|
|
||||||
const signUpWithCode = async (username: string, password: string) => {
|
const signUpWithCode = async (username: string, password: string) => {
|
||||||
|
|
||||||
console.log("-------------", username)
|
console.log("-------------username---------", username, "-------------password---------", password);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isLoading ||
|
isLoading ||
|
||||||
|
|
@ -108,7 +108,7 @@ export function MixSignUp(props: {
|
||||||
|
|
||||||
}).then(function (result: any) {
|
}).then(function (result: any) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
console.log("result:", result)
|
console.log("==================> result:", result)
|
||||||
|
|
||||||
if (result && result.header.code != 0) {
|
if (result && result.header.code != 0) {
|
||||||
|
|
||||||
|
|
@ -129,7 +129,20 @@ export function MixSignUp(props: {
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsLoading(false);
|
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}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue