mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-03-01 01:21:04 +08:00
feat: replace alerts with toast notifications
This commit is contained in:
@@ -68,13 +68,13 @@ export default {
|
||||
const data = await res.json()
|
||||
if (res.ok && data.token) {
|
||||
localStorage.setItem('token', data.token)
|
||||
alert('登录成功')
|
||||
this.$toast.success('登录成功')
|
||||
this.$router.push('/')
|
||||
} else {
|
||||
alert(data.error || '登录失败')
|
||||
this.$toast.error(data.error || '登录失败')
|
||||
}
|
||||
} catch (e) {
|
||||
alert('登录失败')
|
||||
this.$toast.error('登录失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,12 +111,12 @@ export default {
|
||||
const data = await res.json()
|
||||
if (res.ok) {
|
||||
this.emailStep = 1
|
||||
alert('验证码已发送,请查看邮箱')
|
||||
this.$toast.success('验证码已发送,请查看邮箱')
|
||||
} else {
|
||||
alert(data.error || '发送失败')
|
||||
this.$toast.error(data.error || '发送失败')
|
||||
}
|
||||
} catch (e) {
|
||||
alert('发送失败')
|
||||
this.$toast.error('发送失败')
|
||||
}
|
||||
},
|
||||
async verifyCode() {
|
||||
@@ -128,13 +128,13 @@ export default {
|
||||
})
|
||||
const data = await res.json()
|
||||
if (res.ok) {
|
||||
alert('注册成功,请登录')
|
||||
this.$toast.success('注册成功,请登录')
|
||||
this.$router.push('/login')
|
||||
} else {
|
||||
alert(data.error || '注册失败')
|
||||
this.$toast.error(data.error || '注册失败')
|
||||
}
|
||||
} catch (e) {
|
||||
alert('注册失败')
|
||||
this.$toast.error('注册失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user