diff --git a/src/components/Dialogs/PopupReplyInbox.vue b/src/components/Dialogs/PopupReplyInbox.vue index 272140c3..a014bf52 100644 --- a/src/components/Dialogs/PopupReplyInbox.vue +++ b/src/components/Dialogs/PopupReplyInbox.vue @@ -28,6 +28,10 @@ const props = defineProps({ type: Function, default: () => {}, }, + type: { + type: String, + default: "", + }, }); const subject = ref(""); // หัวข้อ @@ -39,14 +43,18 @@ const body = ref(""); //ข้อความ function onSubmit() { dialogConfirm($q, async () => { showLoader(); + const pathAPI = + props.type === "Administrator" + ? config.API.replyMessage(props.idInbox) + : config.API.replyMessage(props.idInbox); await http - .put(config.API.replyMessage(props.idInbox), { + .put(pathAPI, { subject: subject.value, body: body.value, }) .then(() => { - props.clickClose(); success($q, "ส่งข้อความสำเร็จ"); + onClose(); }) .catch((e) => { messageError($q, e); @@ -56,13 +64,26 @@ function onSubmit() { }); }); } + +function onClose() { + subject.value = ""; + body.value = ""; + props.clickClose(); +} + +