From c6ad2f9a8e730925ff45b937ff85ed130e8f86d0 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Mon, 5 Dec 2022 15:33:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=97=A0=E6=B3=95=E5=85=B3=E9=97=AD=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/hooks/use-delete-data.ts | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/frontend/src/hooks/use-delete-data.ts b/frontend/src/hooks/use-delete-data.ts index 20f13fda5..2ce242746 100644 --- a/frontend/src/hooks/use-delete-data.ts +++ b/frontend/src/hooks/use-delete-data.ts @@ -29,20 +29,29 @@ export const useDeleteData =

( if (action === 'confirm') { instance.confirmButtonLoading = true; instance.cancelButtonLoading = true; - const res = await api(params); - done(); - if (!res) return reject(false); - resolve(true); - ElMessage({ - type: 'success', - message: i18n.global.t('commons.msg.operationSuccess'), - }); + + await api(params) + .then((res) => { + done(); + if (!res) return reject(false); + resolve(true); + ElMessage({ + type: 'success', + message: i18n.global.t('commons.msg.operationSuccess'), + }); + }) + .finally(() => { + instance.confirmButtonLoading = false; + instance.cancelButtonLoading = false; + }); } else { done(); } }, }) - .then(() => {}) + .then(() => { + console.log('1111'); + }) .catch(() => {}); }); };