diff --git a/src/components/composable/useConfirmModal.ts b/src/components/composable/useConfirmModal.ts new file mode 100644 index 0000000..85f58a7 --- /dev/null +++ b/src/components/composable/useConfirmModal.ts @@ -0,0 +1,42 @@ +import { type ConfirmationOptions } from "primevue/confirmationoptions"; +import { useConfirm } from "primevue"; +import VButton from "../button/VButton.vue"; + +export function useConfirmModal() { + const confirm = useConfirm(); + + const showConfirmModal = ({ + acceptProps = VButton, + rejectProps = VButton, + group = '', + header = '', + message = '', + icon = '', + accept = Function, + reject = Function, + onHide = Function, + onShow = Function, + modal = true, + blockScroll = true, + position = 'center', + appendTo = 'body', + }: ConfirmationOptions) => { + confirm.require({ + group, + header, + message, + icon, + rejectProps, + acceptProps, + accept, + reject, + onHide, + onShow, + modal, + blockScroll, + position, + appendTo, + }) + } + return {showConfirmModal} +}