forked from AkkomaGang/akkoma-fe
Add await to login befor redirect to friends timeline
This commit is contained in:
parent
1570e779b1
commit
b7d7c21617
1 changed files with 6 additions and 2 deletions
|
@ -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 a new issue