perf:获取短信验证码功能增加try/catch

This commit is contained in:
ktianc 2023-06-19 14:24:09 +08:00
parent f9cc24e84c
commit 63ee93a94b

View File

@ -130,6 +130,7 @@ const getSMSCode = async () => {
SMSCodeNumber.value = 60 SMSCodeNumber.value = 60
const { getFormData } = methods const { getFormData } = methods
const formData = await getFormData<UserLoginType>() const formData = await getFormData<UserLoginType>()
try {
const res = await postSMSCodeApi({ telephone: formData.telephone }) const res = await postSMSCodeApi({ telephone: formData.telephone })
if (res?.data) { if (res?.data) {
let timer = setInterval(() => { let timer = setInterval(() => {
@ -143,6 +144,9 @@ const getSMSCode = async () => {
ElMessage.error('发送失败,请联系管理员') ElMessage.error('发送失败,请联系管理员')
SMSCodeStatus.value = true SMSCodeStatus.value = true
} }
} catch (e: any) {
SMSCodeStatus.value = true
}
} }
}) })
} }