Add await to login befor redirect to friends timeline

This commit is contained in:
jasper 2019-04-09 08:57:41 -07:00
parent 1570e779b1
commit b7d7c21617

View File

@ -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'})
})
})