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

export default LoginForm