diff --git a/src/components/PopupReplyInbox.vue b/src/components/PopupReplyInbox.vue index 1eed8b2..0cdb863 100644 --- a/src/components/PopupReplyInbox.vue +++ b/src/components/PopupReplyInbox.vue @@ -10,7 +10,7 @@ import { useQuasar } from "quasar"; const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง const $q = useQuasar(); -const { showLoader, hideLoader, success, messageError } = mixin; +const { showLoader, hideLoader, success, messageError, dialogConfirm } = mixin; const myForm = ref(); const props = defineProps({ @@ -30,35 +30,34 @@ const props = defineProps({ const subject = ref(""); const body = ref(""); -async function submit() { - myForm.value.validate().then(async (result: boolean) => { - if (result) { - // props.savaForm(reason.value); - showLoader(); - await http - .put(config.API.replyMessage(props.idInbox), { - subject: subject.value, - body: body.value, - }) - .then((res) => { - props.clickClose() - success($q, "ส่งข้อความสำเร็จ"); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(() => { - hideLoader(); - }); - } +function onSubmit() { + dialogConfirm($q, () => { + showLoader(); + http + .put(config.API.replyMessage(props.idInbox), { + subject: subject.value, + body: body.value, + }) + .then(() => { + props.clickClose(); + success($q, "ส่งข้อความสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); }); }