yandere_fe/src/components/login_form/login_form.js

33 lines
763 B
JavaScript
Raw Normal View History

2018-10-26 06:20:39 -07:00
import oauthApi from '../../services/new_api/oauth.js'
2016-10-27 09:02:41 -07:00
const LoginForm = {
data: () => ({
user: {},
authError: false
2016-10-27 09:02:41 -07:00
}),
computed: {
loggingIn () { return this.$store.state.users.loggingIn },
2018-09-09 11:21:23 -07:00
registrationOpen () { return this.$store.state.instance.registrationOpen }
2016-10-27 09:02:41 -07:00
},
methods: {
2018-10-26 06:16:23 -07:00
oAuthLogin () {
oauthApi.login({
oauth: this.$store.state.oauth,
instance: this.$store.state.instance.server,
commit: this.$store.commit
2018-10-26 06:20:39 -07:00
})
2018-10-26 06:16:23 -07:00
},
2016-10-27 09:02:41 -07:00
submit () {
this.$store.dispatch('loginUser', this.user).then(
() => {},
(error) => {
this.authError = error
this.user.username = ''
this.user.password = ''
}
)
2016-10-27 09:02:41 -07:00
}
}
}
export default LoginForm