import VnConfirm from 'components/ui/VnConfirm.vue';
import { useQuasar } from 'quasar';

export function useVnConfirm() {
    const quasar = useQuasar();

    const openConfirmationModal = (title, message, promise, successFn) => {
        quasar
            .dialog({
                component: VnConfirm,
                componentProps: {
                    title: title,
                    message: message,
                    promise: promise,
                },
            })
            .onOk(async () => {
                if (successFn) successFn();
            });
    };

    return { openConfirmationModal };
}
