From 9147a1a1792f43ad2efc2e2b364345d8db458748 Mon Sep 17 00:00:00 2001 From: leslie2046 <253605712@qq.com> Date: Sun, 16 Feb 2025 20:28:34 +0800 Subject: [PATCH] modify --- .../components/app/annotation/header-opts/index.tsx | 12 +++++++----- web/service/annotation.ts | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/web/app/components/app/annotation/header-opts/index.tsx b/web/app/components/app/annotation/header-opts/index.tsx index 2f14af0755..5b7841ee94 100644 --- a/web/app/components/app/annotation/header-opts/index.tsx +++ b/web/app/components/app/annotation/header-opts/index.tsx @@ -79,15 +79,17 @@ const HeaderOptions: FC = ({ const [showBulkImportModal, setShowBulkImportModal] = useState(false) const handleClearAll = async () => { - await confirm({ + const isConfirmed= await confirm({ title: t('appAnnotation.table.header.clearAllConfirm'), type: 'danger', }) - try { - await clearAllAnnotations(appId) - onAdded() - } catch (e) { + if(isConfirmed){ + try { + await clearAllAnnotations(appId) + onAdded() + } catch (e) { console.error(e) + } } } const Operations = () => { diff --git a/web/service/annotation.ts b/web/service/annotation.ts index 0b268ed5d0..c7891604df 100644 --- a/web/service/annotation.ts +++ b/web/service/annotation.ts @@ -65,5 +65,5 @@ export const fetchHitHistoryList = (appId: string, annotationId: string, params: } export const clearAllAnnotations = (appId: string): Promise => { - return post(`apps/${appId}/annotations/${annotationId}/clear-all`) + return post(`apps/${appId}/annotations/clear-all`) }