2016-10-28 03:02:41 +11:00
|
|
|
const LoginForm = {
|
|
|
|
data: () => ({
|
2017-03-09 04:28:41 +11:00
|
|
|
user: {},
|
|
|
|
authError: false
|
2016-10-28 03:02:41 +11:00
|
|
|
}),
|
|
|
|
computed: {
|
2017-06-20 17:37:51 +10:00
|
|
|
loggingIn () { return this.$store.state.users.loggingIn },
|
2018-09-10 02:36:13 +10:00
|
|
|
registrationOpen () { return this.$store.state.interface.registrationOpen }
|
2016-10-28 03:02:41 +11:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit () {
|
2017-03-09 04:28:41 +11:00
|
|
|
this.$store.dispatch('loginUser', this.user).then(
|
2017-03-09 18:51:33 +11:00
|
|
|
() => {},
|
2017-03-09 05:22:56 +11:00
|
|
|
(error) => {
|
|
|
|
this.authError = error
|
2017-03-09 05:08:01 +11:00
|
|
|
this.user.username = ''
|
|
|
|
this.user.password = ''
|
|
|
|
}
|
2017-03-09 04:28:41 +11:00
|
|
|
)
|
2016-10-28 03:02:41 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LoginForm
|