aboutsummaryrefslogtreecommitdiff
path: root/src/components/login_form/login_form.js
blob: a117b76fd24f8acaa3a6a438a4c11c357bac8112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const LoginForm = {
  data: () => ({
    user: {},
    authError: false
  }),
  computed: {
    loggingIn () { return this.$store.state.users.loggingIn },
    registrationOpen () { return this.$store.state.config.registrationOpen }
  },
  methods: {
    submit () {
      this.$store.dispatch('loginUser', this.user).then(
        () => {},
        (error) => {
          this.authError = error
          this.user.username = ''
          this.user.password = ''
        }
      )
    }
  }
}

export default LoginForm