diff --git a/frontend/app/mstore/settingsStore.ts b/frontend/app/mstore/settingsStore.ts index d9dfb0dd3..7dd584fd3 100644 --- a/frontend/app/mstore/settingsStore.ts +++ b/frontend/app/mstore/settingsStore.ts @@ -71,11 +71,16 @@ export default class SettingsStore { return webhookService.saveWebhook(inst) .then(data => { this.webhookInst = new Webhook(data) - this.webhooks = [...this.webhooks, this.webhookInst] + if (inst.webhookId === undefined) this.setWebhooks([...this.webhooks, this.webhookInst]) + else this.setWebhooks([...this.webhooks.filter(hook => hook.webhookId !== data.webhookId), this.webhookInst]) this.hooksLoading = false }) } + setWebhooks = (webhooks: Webhook[]) => { + this.webhooks = webhooks + } + removeWebhook = (hookId: string) => { this.hooksLoading = true return webhookService.removeWebhook(hookId)