Browse Source

fix(gui-v2): payload body issue

pull/2838/head
Wing-Kam Wong 2 years ago
parent
commit
b42238f7ac
  1. 16
      packages/nc-gui-v2/components/webhook/Editor.vue

16
packages/nc-gui-v2/components/webhook/Editor.vue

@ -217,17 +217,7 @@ const validators = computed(() => {
const { resetFields, validate, validateInfos } = useForm(hook, validators) const { resetFields, validate, validateInfos } = useForm(hook, validators)
function onNotTypeChange() { function onNotTypeChange() {
const notification = { hook.notification.payload = {} as any
method: 'GET',
path: '',
body: '',
params: [],
auth: '',
headers: [],
response: {},
perf: {},
meta: {},
}
if (hook.notification.type === 'Slack') { if (hook.notification.type === 'Slack') {
slackChannels.value = (apps && apps?.Slack && apps.Slack.parsedInput) || [] slackChannels.value = (apps && apps?.Slack && apps.Slack.parsedInput) || []
@ -242,7 +232,6 @@ function onNotTypeChange() {
mattermostChannels.value = (apps && apps.Mattermost && apps.Mattermost.parsedInput) || [] mattermostChannels.value = (apps && apps.Mattermost && apps.Mattermost.parsedInput) || []
} }
if (hook.notification.type === 'URL') { if (hook.notification.type === 'URL') {
hook.notification = hook.notification ?? notification
hook.notification.payload.body = '{{ json data }}' hook.notification.payload.body = '{{ json data }}'
} }
} }
@ -272,8 +261,6 @@ async function onEventChange() {
}, },
}) })
await onNotTypeChange()
hook.notification.payload = payload hook.notification.payload = payload
let channels: Record<string, any>[] | null = null let channels: Record<string, any>[] | null = null
@ -303,7 +290,6 @@ async function onEventChange() {
if (hook.notification.type === 'URL') { if (hook.notification.type === 'URL') {
hook.notification.payload = hook.notification.payload || {} hook.notification.payload = hook.notification.payload || {}
hook.notification.payload.body = '{{ json data }}'
} }
} }

Loading…
Cancel
Save