// useModal.js
import { onMounted, ref } from 'vue';

export function useModal(modalId) {
    const isVisible = ref(false);

    onMounted(() => {
        const modalEl = document.getElementById(modalId);

        modalEl.addEventListener('show.bs.modal', () => {
            isVisible.value = true;
        });

        modalEl.addEventListener('hidden.bs.modal', () => {
            isVisible.value = false;
        });
    });

    return { isVisible };
}