client: close webhook settings page automatically

Changelog: Fixed
This commit is contained in:
Johann150 2022-11-20 12:33:04 +01:00
parent e59706e36f
commit 3c4302cf3b
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 13 additions and 2 deletions

View file

@ -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<void> {
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<void> {
on: events,
active,
});
router.push('/settings/webhook');
}
async function del(): Promise<void> {
@ -89,6 +94,7 @@ async function del(): Promise<void> {
await os.apiWithDialog('i/webhooks/delete', {
webhookId: webhook.id,
});
router.push('/settings/webhook');
}
definePageMetadata({

View file

@ -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<void> {
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({