优化:请求接口全局处理loading和错误提示
This commit is contained in:
@@ -191,16 +191,12 @@ const getCode = async () => {
|
||||
if (!isEmailEmpty()) return
|
||||
if (!isEmailVerified(email.value)) return
|
||||
|
||||
try {
|
||||
await commonApi.sendMailCaptcha(email.value)
|
||||
uni.showToast({
|
||||
title: t('login.sendCodeSuccess'),
|
||||
icon: 'none'
|
||||
})
|
||||
getCodeState()
|
||||
} catch (error) {
|
||||
console.error('Send code error:', error)
|
||||
}
|
||||
await commonApi.sendMailCaptcha(email.value)
|
||||
uni.showToast({
|
||||
title: t('login.sendCodeSuccess'),
|
||||
icon: 'none'
|
||||
})
|
||||
getCodeState()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -264,20 +260,16 @@ const onSubmit = async () => {
|
||||
if (!isConfirmPasswordEmpty()) return
|
||||
if (!isPasswordMatch()) return
|
||||
|
||||
try {
|
||||
await resetPassword(email.value, code.value, password.value)
|
||||
await resetPassword(email.value, code.value, password.value)
|
||||
|
||||
uni.showModal({
|
||||
title: t('global.tips'),
|
||||
content: t('forget.passwordChanged'),
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
uni.navigateBack()
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Reset password error:', error)
|
||||
}
|
||||
uni.showModal({
|
||||
title: t('global.tips'),
|
||||
content: t('forget.passwordChanged'),
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
uni.navigateBack()
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user