2016-10-27 16:02:41 +00:00
|
|
|
const LoginForm = {
|
|
|
|
data: () => ({
|
2017-03-08 17:28:41 +00:00
|
|
|
user: {},
|
|
|
|
authError: false
|
2016-10-27 16:02:41 +00:00
|
|
|
}),
|
|
|
|
computed: {
|
|
|
|
loggingIn () { return this.$store.state.users.loggingIn }
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit () {
|
2017-03-08 17:28:41 +00:00
|
|
|
this.$store.dispatch('loginUser', this.user).then(
|
|
|
|
() => { this.$router.push('/main/friends')},
|
2017-03-08 18:22:56 +00:00
|
|
|
(error) => {
|
|
|
|
this.authError = error
|
2017-03-08 18:08:01 +00:00
|
|
|
this.user.username = ''
|
|
|
|
this.user.password = ''
|
|
|
|
}
|
2017-03-08 17:28:41 +00:00
|
|
|
)
|
2016-10-27 16:02:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LoginForm
|