Browse Source

feat(nc-gui): add delete modal in deleteHook

pull/5317/head
Wing-Kam Wong 2 years ago
parent
commit
97b4e53345
  1. 43
      packages/nc-gui/components/webhook/List.vue

43
packages/nc-gui/components/webhook/List.vue

@ -25,24 +25,33 @@ async function loadHooksList() {
}
async function deleteHook(item: HookType, index: number) {
try {
if (item.id) {
await $api.dbTableWebhook.delete(item.id)
hooks.value.splice(index, 1)
} else {
hooks.value.splice(index, 1)
}
// Hook deleted successfully
message.success(t('msg.success.webhookDeleted'))
if (!hooks.value.length) {
hooks.value = []
}
} catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e))
}
Modal.confirm({
title: `Do you want to delete '${item.title}'?`,
wrapClassName: 'nc-modal-hook-delete',
okText: 'Yes',
okType: 'danger',
cancelText: 'No',
async onOk() {
try {
if (item.id) {
await $api.dbTableWebhook.delete(item.id)
hooks.value.splice(index, 1)
} else {
hooks.value.splice(index, 1)
}
// Hook deleted successfully
message.success(t('msg.success.webhookDeleted'))
if (!hooks.value.length) {
hooks.value = []
}
} catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e))
}
$e('a:webhook:delete')
$e('a:webhook:delete')
},
})
}
async function copyHook(hook: HookType) {

Loading…
Cancel
Save