﻿<script setup>
import LoginForm from "@/views/main/LoginForm.vue";

const isOpen = defineModel();

const props = defineProps({
  message: {
    type: String,
    required: true,
  },
});

const handleSuccess = () => {
  console.log('handleSuccess triggered');
  isOpen.value = false;
}

const handleFailure = () => {
  console.error('Login failed');
}

const closeModal = async () => {
  console.log('closeModal triggered');
  isOpen.value = false;
}

</script>

<template>
  <v-dialog v-model="isOpen" max-width="400">
    <v-card>
      <div class="flex flex-col items-center">
        <v-img src="/images/usersmedia/HutopyProfile/profilepictures/profileHutopyProfile01.png" class="w-50"></v-img>
        <LoginForm :onSuccess="handleSuccess" :onFailure="handleFailure"></LoginForm>
        <v-card-text>{{ message }}</v-card-text>
      </div>
      <v-card-actions>
        <v-btn color="primary" text @click="closeModal">Fermer</v-btn>
      </v-card-actions>
    </v-card>
  </v-dialog>
</template>
