forked from FoundKeyGang/FoundKey
client: close webhook settings page automatically
Changelog: Fixed
This commit is contained in:
parent
e59706e36f
commit
3c4302cf3b
2 changed files with 13 additions and 2 deletions
|
@ -42,6 +42,9 @@ import FormButton from '@/components/ui/button.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
import { useRouter } from '@/router';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const webhook = await os.api('i/webhooks/show', {
|
const webhook = await os.api('i/webhooks/show', {
|
||||||
webhookId: new URLSearchParams(window.location.search).get('id'),
|
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_reaction) events.push('reaction');
|
||||||
if (event_mention) events.push('mention');
|
if (event_mention) events.push('mention');
|
||||||
|
|
||||||
os.apiWithDialog('i/webhooks/update', {
|
await os.apiWithDialog('i/webhooks/update', {
|
||||||
webhookId: webhook.id,
|
webhookId: webhook.id,
|
||||||
name,
|
name,
|
||||||
url,
|
url,
|
||||||
|
@ -78,6 +81,8 @@ async function save(): Promise<void> {
|
||||||
on: events,
|
on: events,
|
||||||
active,
|
active,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.push('/settings/webhook');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function del(): Promise<void> {
|
async function del(): Promise<void> {
|
||||||
|
@ -89,6 +94,7 @@ async function del(): Promise<void> {
|
||||||
await os.apiWithDialog('i/webhooks/delete', {
|
await os.apiWithDialog('i/webhooks/delete', {
|
||||||
webhookId: webhook.id,
|
webhookId: webhook.id,
|
||||||
});
|
});
|
||||||
|
router.push('/settings/webhook');
|
||||||
}
|
}
|
||||||
|
|
||||||
definePageMetadata({
|
definePageMetadata({
|
||||||
|
|
|
@ -39,6 +39,9 @@ import FormButton from '@/components/ui/button.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
import { useRouter } from '@/router';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
let name = $ref('');
|
let name = $ref('');
|
||||||
let url = $ref('');
|
let url = $ref('');
|
||||||
|
@ -62,12 +65,14 @@ async function create(): Promise<void> {
|
||||||
if (event_reaction) events.push('reaction');
|
if (event_reaction) events.push('reaction');
|
||||||
if (event_mention) events.push('mention');
|
if (event_mention) events.push('mention');
|
||||||
|
|
||||||
os.apiWithDialog('i/webhooks/create', {
|
await os.apiWithDialog('i/webhooks/create', {
|
||||||
name,
|
name,
|
||||||
url,
|
url,
|
||||||
secret,
|
secret,
|
||||||
on: events,
|
on: events,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.push('/settings/webhook');
|
||||||
}
|
}
|
||||||
|
|
||||||
definePageMetadata({
|
definePageMetadata({
|
||||||
|
|
Loading…
Reference in a new issue