From 7c957419aeb3aadf7c564dda12e0054faa2397da Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Mon, 11 Sep 2023 12:13:24 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=95=E0=B9=88=E0=B8=AD=20api=20delete=20no?= =?UTF-8?q?tification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/00_dashboard/api.message.ts | 1 + src/views/MainLayout.vue | 30 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/api/00_dashboard/api.message.ts b/src/api/00_dashboard/api.message.ts index 75902df05..e25ce5aff 100644 --- a/src/api/00_dashboard/api.message.ts +++ b/src/api/00_dashboard/api.message.ts @@ -8,4 +8,5 @@ const message = `${env.API_PLACEMENT_URI}/message`; export default { msgNotificate: `${message}/my-notifications`, msgInbox: `${message}/my-inboxes`, + msgId: (id: string) => `${message}/my-notifications/${id}`, }; diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index b0f11fb8f..b874856d6 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -39,6 +39,7 @@ const { const DataStore = useroleUserDataStore(); const { fetchroleUser } = DataStore; +const id = ref(""); const $q = useQuasar(); const { tabData, loader } = storeToRefs(store); const { changeTab } = store; @@ -405,19 +406,20 @@ if (keycloak.tokenParsed != null) { } const deleteData = async (id: string) => { - await http; - // .delete(config.API.copyOrderId(id)) - // .then((res) => { - // // const data = res.data.result; - // // console.log(res); - // success($q, "ลบข้อมูลสำเร็จ"); - // }) - // .catch((e) => { - // messageError($q, e); - // }) - // .finally(async () => { - // // hideLoader(); - // }); + console.log("delete=", id); + showLoader(); + await http + .delete(config.API.msgId(id)) + .then((res) => { + success($q, "ลบข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + getDataNotification(); + hideLoader(); + }); }; const clickDelete = (id: string) => { @@ -509,7 +511,7 @@ const clickDelete = (id: string) => { dense icon="mdi-close" class="mybtn q-mx-xs" - @click="clickDelete" + @click="clickDelete(n.id)" >