From 3c4302cf3b26b0ff86ac5b7c07de1d9244ccc71d Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sun, 20 Nov 2022 12:33:04 +0100 Subject: [PATCH] client: close webhook settings page automatically Changelog: Fixed --- packages/client/src/pages/settings/webhook.edit.vue | 8 +++++++- packages/client/src/pages/settings/webhook.new.vue | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/client/src/pages/settings/webhook.edit.vue b/packages/client/src/pages/settings/webhook.edit.vue index c35ceb114..49ba413ff 100644 --- a/packages/client/src/pages/settings/webhook.edit.vue +++ b/packages/client/src/pages/settings/webhook.edit.vue @@ -42,6 +42,9 @@ import FormButton from '@/components/ui/button.vue'; import * as os from '@/os'; import { i18n } from '@/i18n'; import { definePageMetadata } from '@/scripts/page-metadata'; +import { useRouter } from '@/router'; + +const router = useRouter(); const webhook = await os.api('i/webhooks/show', { webhookId: new URLSearchParams(window.location.search).get('id'), @@ -70,7 +73,7 @@ async function save(): Promise { if (event_reaction) events.push('reaction'); if (event_mention) events.push('mention'); - os.apiWithDialog('i/webhooks/update', { + await os.apiWithDialog('i/webhooks/update', { webhookId: webhook.id, name, url, @@ -78,6 +81,8 @@ async function save(): Promise { on: events, active, }); + + router.push('/settings/webhook'); } async function del(): Promise { @@ -89,6 +94,7 @@ async function del(): Promise { await os.apiWithDialog('i/webhooks/delete', { webhookId: webhook.id, }); + router.push('/settings/webhook'); } definePageMetadata({ diff --git a/packages/client/src/pages/settings/webhook.new.vue b/packages/client/src/pages/settings/webhook.new.vue index b3700da9f..85eb7db06 100644 --- a/packages/client/src/pages/settings/webhook.new.vue +++ b/packages/client/src/pages/settings/webhook.new.vue @@ -39,6 +39,9 @@ import FormButton from '@/components/ui/button.vue'; import * as os from '@/os'; import { i18n } from '@/i18n'; import { definePageMetadata } from '@/scripts/page-metadata'; +import { useRouter } from '@/router'; + +const router = useRouter(); let name = $ref(''); let url = $ref(''); @@ -62,12 +65,14 @@ async function create(): Promise { if (event_reaction) events.push('reaction'); if (event_mention) events.push('mention'); - os.apiWithDialog('i/webhooks/create', { + await os.apiWithDialog('i/webhooks/create', { name, url, secret, on: events, }); + + router.push('/settings/webhook'); } definePageMetadata({