This commit is contained in:
parent
06f845d841
commit
c18a99dfdb
|
|
@ -105,30 +105,23 @@ export function MixSignUp(props: {
|
|||
await service.post('/api/v1/common/auth-code', {
|
||||
user_name: username,
|
||||
email: username,
|
||||
|
||||
}).then(function (result: any) {
|
||||
setIsLoading(false);
|
||||
console.log("==================> result:", result)
|
||||
console.log("==================> result:", result);
|
||||
|
||||
if (result && result.header.code != 0) {
|
||||
|
||||
toast.error(result.header.message)
|
||||
return
|
||||
// 如果返回的header中的code不为0,表示失败
|
||||
if (result && result.header.code !== 0) {
|
||||
toast.error(result.header.message); // 提示错误信息
|
||||
return;
|
||||
}
|
||||
|
||||
props.password(password)
|
||||
toast.success(result.header.message)
|
||||
props.setVerification(true);
|
||||
|
||||
{ {/* localStorage["name"]="bonly"; */ } }
|
||||
props.password(password); // 设置密码
|
||||
toast.success(result.header.message); // 提示成功信息
|
||||
props.setVerification(true); // 更新状态
|
||||
|
||||
}).catch((err: any) => {
|
||||
setIsLoading(false);
|
||||
console.log(err);
|
||||
|
||||
});
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
// 更详细的错误信息
|
||||
if (err.response) {
|
||||
// 如果是网络请求返回的错误(如 4xx 或 5xx 错误)
|
||||
|
|
@ -143,7 +136,13 @@ export function MixSignUp(props: {
|
|||
console.error("General Error:", err.message);
|
||||
toast.error(`发生了一个错误: ${err.message}`);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
setIsLoading(false);
|
||||
console.error("Unexpected Error:", err);
|
||||
toast.error("发生了一个意外错误");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue