|
|
@ -31,15 +31,19 @@ const LoginForm = {
|
|
|
|
username: this.user.username,
|
|
|
|
username: this.user.username,
|
|
|
|
password: this.user.password
|
|
|
|
password: this.user.password
|
|
|
|
}
|
|
|
|
}
|
|
|
|
).then((result) => {
|
|
|
|
).then(async (result) => {
|
|
|
|
if (result.error) {
|
|
|
|
if (result.error) {
|
|
|
|
this.authError = result.error
|
|
|
|
this.authError = result.error
|
|
|
|
this.user.password = ''
|
|
|
|
this.user.password = ''
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.$store.commit('setToken', result.access_token)
|
|
|
|
this.$store.commit('setToken', result.access_token)
|
|
|
|
this.$store.dispatch('loginUser', result.access_token)
|
|
|
|
try {
|
|
|
|
this.$router.push({name: 'friends'})
|
|
|
|
await this.$store.dispatch('loginUser', result.access_token)
|
|
|
|
|
|
|
|
this.$router.push({name: 'friends'})
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
console.log(e)
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|