1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-02-12 11:30:07 +08:00

fix: 解决删除失败无法关闭弹窗的BUG

This commit is contained in:
zhengkunwang223 2022-12-05 15:33:38 +08:00 committed by zhengkunwang223
parent e1f0079585
commit c6ad2f9a8e

View File

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