From c20ce12f862fdaedba8d6313a21281a6c6a4f48a Mon Sep 17 00:00:00 2001 From: Caipira Date: Sun, 5 Feb 2023 20:31:38 +0900 Subject: [PATCH] enhance(client): add webhook delete button (#9806) --- .../src/pages/settings/webhook.edit.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/frontend/src/pages/settings/webhook.edit.vue b/packages/frontend/src/pages/settings/webhook.edit.vue index 7a819eb9f0..a01e3f8cee 100644 --- a/packages/frontend/src/pages/settings/webhook.edit.vue +++ b/packages/frontend/src/pages/settings/webhook.edit.vue @@ -31,6 +31,7 @@
{{ i18n.ts.save }} + {{ i18n.ts.delete }}
@@ -44,6 +45,9 @@ import MkButton from '@/components/MkButton.vue'; import * as os from '@/os'; import { i18n } from '@/i18n'; import { definePageMetadata } from '@/scripts/page-metadata'; +import { useRouter } from '@/router'; + +const router = useRouter(); const props = defineProps<{ webhookId: string; @@ -86,6 +90,19 @@ async function save(): Promise { }); } +async function del(): Promise { + const { canceled } = await os.confirm({ + type: 'warning', + text: i18n.t('deleteAreYouSure', { x: webhook.name }), + }); + if (canceled) return; + + await os.apiWithDialog('i/webhooks/delete', { + webhookId: props.webhookId, + }); + + router.push('/settings/webhook'); +} const headerActions = $computed(() => []); const headerTabs = $computed(() => []);