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