From 4079eb1b847fea75f3f2416b6122531576723051 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 19 Jan 2024 16:12:02 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=94=E0=B8=B1=E0=B8=81=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B9=82=E0=B8=AB=E0=B8=A5=E0=B8=94=20=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B9=81=E0=B8=88=E0=B9=89=E0=B8=87=E0=B9=80?= =?UTF-8?q?=E0=B8=95=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/MainLayout.vue | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index f2e453a..11937eb 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -58,7 +58,7 @@ const fetchlistNotification = async (index: number, type: string) => { const data = res.data.result.data; totalInbox.value = res.data.result.total; let list: any[] = []; - if (type === "DEL" || index === 1) { + if (type === "DEL") { notiList.value = []; } data.map((e: any) => { @@ -122,11 +122,16 @@ const clickDelete = async (id: string, index: number) => { const totalInbox = ref(0); const page = ref(0); async function onLoad(index: any, done: any) { - page.value++; - setTimeout(async () => { - await fetchlistNotification(page.value, "NOMAL"); - done(); - }, 1500); + if ( + notiList.value.length < totalInbox.value || + (notiList.value.length === 0 && totalInbox.value === 0) + ) { + page.value++; + setTimeout(async () => { + await fetchlistNotification(page.value, "NOMAL"); + done(); + }, 1500); + } } watch( @@ -292,7 +297,13 @@ const thaiOptions: Intl.DateTimeFormatOptions = { -