<script setup lang="ts">
import { axiosInstance } from '@/main'
import type { VueCookies } from 'vue3-cookies/dist/interfaces'
import { inject } from 'vue'

const emit = defineEmits(['close']);

function sendLogin() {
  emit('close');
  axiosInstance.post('/login', {
    username: 'testowyj',
    password: 'beihiegei5Fied0b'
  }, {
    withCredentials: true
  });

  const $cookies = inject<VueCookies>('$cookies');
  console.log($cookies);
}

</script>

<template>
  <div>
    <div class="modal is-active">
      <div class="modal-background"></div>
      <div class="modal-card p-3">
        <header class="modal-card-head">
          <p class="modal-card-title">Logowanie</p>
          <button class="delete" aria-label="close" @click="$emit('close')"></button>
        </header>
        <section class="modal-card-body">
          <form>

          </form>
        </section>
        <footer class="modal-card-foot">
          <div class="buttons">
            <button class="button is-success" @click="sendLogin">Zaloguj się</button>
            <button class="button" @click="$emit('close')">Anuluj</button>
          </div>
        </footer>
      </div>
    </div>
  </div>
</template>