Add back that login error thing that someone removed

This commit is contained in:
shpuld 2019-01-28 17:43:51 +02:00
parent 3b1cafc19f
commit 1b76a5a9ea
4 changed files with 52 additions and 22 deletions

View file

@ -22,6 +22,7 @@ const LoginForm = {
oauth: this.$store.state.oauth,
instance: this.$store.state.instance.server
}
this.clearError()
oauthApi.getOrCreateApp(data).then((app) => {
oauthApi.getTokenWithCredentials(
{
@ -30,11 +31,19 @@ const LoginForm = {
username: this.user.username,
password: this.user.password})
.then((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)
this.$router.push({name: 'friends'})
})
})
},
clearError () {
this.authError = false
}
}
}