<script setup lang="js">
  import { ref } from 'vue';
  import { useAuthStore} from '@/stores/authStore.js';

  const store = useAuthStore();

  const email = ref('');
  const password = ref('');


  const onSubmit = () => {
    store.login(email.value, password.value);
  };
</script>

<template>
  <h1> Login view </h1>
  <div>
    <form @submit.prevent="onSubmit">
      <div>
        <label for="email">Email</label>
        <input type="email" name="email" v-model="email">
      </div>

      <div>
        <label for="password">Password</label>
        <input type="password" name="password" v-model="password">
      </div>

      <div>
        <button type="submit">Login</button>
      </div>
    </form>
  </div>
</template>

<style scoped>

</style>
