修复开启两步失败提醒

This commit is contained in:
hanhh 2021-09-08 12:26:05 +08:00
parent 1265e465d0
commit bf43bfbd92

View File

@ -55,6 +55,7 @@ const SecuritySettings = ({ user, userChange }: any) => {
};
const completeTowFactor = () => {
setLoading(true);
request
.put(`${config.apiPrefix}user/two-factor/active`, { data: { code } })
.then((data: any) => {
@ -63,11 +64,14 @@ const SecuritySettings = ({ user, userChange }: any) => {
setTwoFactoring(false);
setTwoFactorActived(true);
userChange();
} else {
message.success('验证失败');
}
})
.catch((error: any) => {
console.log(error);
});
})
.finally(() => setLoading(false));
};
const getTwoFactorInfo = () => {
@ -132,7 +136,7 @@ const SecuritySettings = ({ user, userChange }: any) => {
onChange={(e) => setCode(e.target.value)}
placeholder="123456"
/>
<Button type="primary" onClick={completeTowFactor}>
<Button type="primary" loading={loading} onClick={completeTowFactor}>
</Button>
</div>