enhance(client): add webhook delete button (#9806)

This commit is contained in:
Caipira 2023-02-05 20:31:38 +09:00 committed by GitHub
parent 1e28db2396
commit c20ce12f86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -31,6 +31,7 @@
<div class="_buttons"> <div class="_buttons">
<MkButton primary inline @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton> <MkButton primary inline @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
<MkButton danger inline @click="del"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div> </div>
</div> </div>
</template> </template>
@ -44,6 +45,9 @@ import MkButton from '@/components/MkButton.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 props = defineProps<{ const props = defineProps<{
webhookId: string; webhookId: string;
@ -86,6 +90,19 @@ async function save(): Promise<void> {
}); });
} }
async function del(): Promise<void> {
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.t('deleteAreYouSure', { x: webhook.name }),
});
if (canceled) return;
await os.apiWithDialog('i/webhooks/delete', {
webhookId: props.webhookId,
});
router.push('/settings/webhook');
}
const headerActions = $computed(() => []); const headerActions = $computed(() => []);
const headerTabs = $computed(() => []); const headerTabs = $computed(() => []);