Add await to login befor redirect to friends timeline
This commit is contained in:
parent
1570e779b1
commit
b7d7c21617
@ -31,14 +31,18 @@ const LoginForm = {
|
||||
username: this.user.username,
|
||||
password: this.user.password
|
||||
}
|
||||
).then((result) => {
|
||||
).then(async (result) => {
|
||||
if (result.error) {
|
||||
this.authError = result.error
|
||||
this.user.password = ''
|
||||
return
|
||||
}
|
||||
this.$store.commit('setToken', result.access_token)
|
||||
this.$store.dispatch('loginUser', result.access_token)
|
||||
try {
|
||||
await this.$store.dispatch('loginUser', result.access_token)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
this.$router.push({name: 'friends'})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user