diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index ad9e3bb3c..09bb224d8 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -95,14 +95,22 @@ const removeData = async (id: string) => { showLoader(); await http .delete(config.API.msgInboxDelete(id)) - .then((res) => { + .then(() => { success($q, "ลบข้อมูลสำเร็จ"); + const position = inboxList.value.findIndex((item) => item.no === id); + if (position !== -1) { + inboxList.value.splice(position, 1); + data.value = []; + } }) .catch((e) => { messageError($q, e); }) .finally(() => { - // getData(); + if (inboxList.value.length === 6) { + inboxList.value = []; + getData(1); + } hideLoader(); }); }; @@ -122,6 +130,7 @@ function modalReplyClose() { const scrollTargetRef = ref(null); const totalInbox = ref(0); + function onLoad(index: number, done: any) { const num = index === 1 ? 0 : index++; if (inboxList.value.length < totalInbox.value && isLoadInbox) { @@ -157,7 +166,9 @@ const thaiOptions: Intl.DateTimeFormatOptions = {
กล่องข้อความ
-
ทั้งหมด {{ totalInbox }} ข้อความ
+
+ ทั้งหมด {{ totalInbox }} ข้อความ +
@@ -172,10 +183,7 @@ const thaiOptions: Intl.DateTimeFormatOptions = { class="q-pa-sm" :scroll-target="scrollTargetRef" > - +