<template>
  <div>
    <div>
      <div>
        <input v-model="form.phone" />
        <input v-model="form.password" />
      </div>
      <div>
        <button v-if="$auth.loggedIn" @click="logout()">logout</button>
        <button v-else @click="login()">login</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'LoginPage',
  data() {
    return {
      form: {
        phone: '17600000010',
        password: '1234567890',
      },
    };
  },
  methods: {
    login() {
      return this.$auth.loginWith('password', {
        data: this.form,
      });
    },
    logout() {
      return this.$auth.logout();
    },
  },
};
</script>

