2016-10-27 09:02:41 -07:00
|
|
|
const LoginForm = {
|
|
|
|
data: () => ({
|
2017-03-08 09:28:41 -08:00
|
|
|
user: {},
|
|
|
|
authError: false
|
2016-10-27 09:02:41 -07:00
|
|
|
}),
|
|
|
|
computed: {
|
2017-06-20 00:37:51 -07:00
|
|
|
loggingIn () { return this.$store.state.users.loggingIn },
|
|
|
|
registrationOpen () { return this.$store.state.config.registrationOpen }
|
2016-10-27 09:02:41 -07:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit () {
|
2017-03-08 09:28:41 -08:00
|
|
|
this.$store.dispatch('loginUser', this.user).then(
|
2017-03-08 23:51:33 -08:00
|
|
|
() => {},
|
2017-03-08 10:22:56 -08:00
|
|
|
(error) => {
|
|
|
|
this.authError = error
|
2017-03-08 10:08:01 -08:00
|
|
|
this.user.username = ''
|
|
|
|
this.user.password = ''
|
|
|
|
}
|
2017-03-08 09:28:41 -08:00
|
|
|
)
|
2016-10-27 09:02:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LoginForm
|