fix(ui): fix webhook duplicating
This commit is contained in:
parent
92be78f509
commit
64cc9ea72d
1 changed files with 6 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue