优化登陆逻辑代码
This commit is contained in:
parent
0c3bc9bc48
commit
885f35851a
@ -173,26 +173,19 @@ export default class extends Vue {
|
||||
})
|
||||
}
|
||||
|
||||
private handleLogin() {
|
||||
(this.$refs.loginForm as ElForm).validate(async(valid: boolean) => {
|
||||
if (valid) {
|
||||
private async handleLogin() {
|
||||
try {
|
||||
await (this.$refs.loginForm as ElForm).validate()
|
||||
this.loading = true
|
||||
await UserModule.Login(this.loginForm)
|
||||
this.$router.push({
|
||||
await this.$router.push({
|
||||
path: this.redirect || '/',
|
||||
query: this.otherQuery
|
||||
}).catch(err => {
|
||||
// console.warn(err)
|
||||
this.loading = false
|
||||
})
|
||||
// Just to simulate the time of the request
|
||||
setTimeout(() => {
|
||||
} catch (err) {
|
||||
console.warn(err)
|
||||
this.loading = false
|
||||
}, 0.5 * 1000)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private getOtherQuery(query: Dictionary<string>) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user