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 { 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({
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in a new issue