fix TypeScript and ESLint errors in instance-info.vue

This commit is contained in:
Hazelnoot 2024-10-11 10:31:31 -04:00
parent fb9b6b1208
commit 66a88c89b5

View file

@ -363,41 +363,46 @@ function refreshMetadata(): void {
}); });
} }
async function deleteAllFiles(): void { async function deleteAllFiles(): Promise<void> {
if (!instance.value) throw new Error('No instance?');
const confirm = await os.confirm({ const confirm = await os.confirm({
type: 'danger', type: 'warning',
text: i18n.ts.deleteAllFilesConfirm, text: i18n.ts.deleteAllFilesConfirm,
}); });
if (confirm.canceled) return; if (confirm.canceled) return;
if (!instance.value) throw new Error('No instance?'); await Promise.all([
await misskeyApi('admin/federation/delete-all-files', { misskeyApi('admin/federation/delete-all-files', {
host: instance.value.host, host: instance.value.host,
}); }),
await os.alert({ os.alert({
text: i18n.ts.deleteAllFilesQueued, text: i18n.ts.deleteAllFilesQueued,
}); }),
]);
} }
async function severAllFollowRelations(): void { async function severAllFollowRelations(): Promise<void> {
if (!instance.value) throw new Error('No instance?'); if (!instance.value) throw new Error('No instance?');
const confirm = await os.confirm({ const confirm = await os.confirm({
type: 'danger', type: 'warning',
text: i18n.tsx.severAllFollowRelationsConfirm({ text: i18n.tsx.severAllFollowRelationsConfirm({
instanceName: instance.value.shortName ?? instance.value.name, instanceName: instance.value.name ?? instance.value.host,
followingCount: instance.value.followingCount, followingCount: instance.value.followingCount,
followersCount: instance.value.followersCount, followersCount: instance.value.followersCount,
}), }),
}); });
if (confirm.canceled) return; if (confirm.canceled) return;
await misskeyApi('admin/federation/remove-all-following', { await Promise.all([
misskeyApi('admin/federation/remove-all-following', {
host: instance.value.host, host: instance.value.host,
}); }),
await os.alert({ os.alert({
text: i18n.tsx.severAllFollowRelationsQueued({ host: instance.value.host }), text: i18n.tsx.severAllFollowRelationsQueued({ host: instance.value.host }),
}); }),
]);
} }
fetch(); fetch();