import { Ref } from 'vue'; import { Modal } from 'bootstrap'; export const getModalActions = (showClose: boolean, ref?: Ref) => { const createModal = () => new Modal(ref?.value, { backdrop: 'static', keyboard: showClose, }); const getOrCreateModal = () => Modal.getInstance(ref?.value) || createModal(); const open = () => getOrCreateModal()?.show(); const close = () => getOrCreateModal()?.hide(); return { open, close }; };