fix(ui): fix webhook duplicating

This commit is contained in:
nick-delirium 2023-01-30 14:27:38 +01:00
parent 92be78f509
commit 64cc9ea72d

View file

@ -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)