mirror of
https://codeberg.org/yeentown/barkey
synced 2024-12-04 21:27:26 +00:00
22c4e9d7ec
* fix(frontend): modalが正しく閉じられていないのを修正 * Update packages/frontend/src/components/MkSystemWebhookEditor.vue Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { defineAsyncComponent } from 'vue';
|
|
import * as os from '@/os.js';
|
|
|
|
export type SystemWebhookEventType = 'abuseReport' | 'abuseReportResolved';
|
|
|
|
export type MkSystemWebhookEditorProps = {
|
|
mode: 'create' | 'edit';
|
|
id?: string;
|
|
requiredEvents?: SystemWebhookEventType[];
|
|
};
|
|
|
|
export type MkSystemWebhookResult = {
|
|
id?: string;
|
|
isActive: boolean;
|
|
name: string;
|
|
on: SystemWebhookEventType[];
|
|
url: string;
|
|
secret: string;
|
|
};
|
|
|
|
export async function showSystemWebhookEditorDialog(props: MkSystemWebhookEditorProps): Promise<MkSystemWebhookResult | null> {
|
|
const { result } = await new Promise<{ result: MkSystemWebhookResult | null }>(async resolve => {
|
|
const { dispose } = os.popup(
|
|
defineAsyncComponent(() => import('@/components/MkSystemWebhookEditor.vue')),
|
|
props,
|
|
{
|
|
submitted: (ev: MkSystemWebhookResult) => {
|
|
resolve({ result: ev });
|
|
},
|
|
canceled: () => {
|
|
resolve({ result: null });
|
|
},
|
|
closed: () => {
|
|
dispose();
|
|
},
|
|
},
|
|
);
|
|
});
|
|
|
|
return result;
|
|
}
|