This commit is contained in:
kakkokari-gtyih 2024-10-27 17:22:18 +09:00
parent e7a185e2c4
commit 21bfddf755
7 changed files with 20 additions and 18 deletions

View File

@ -99,19 +99,19 @@ async function addUser() {
const { canceled: canceled1, result: username } = await os.inputText({ const { canceled: canceled1, result: username } = await os.inputText({
title: i18n.ts.username, title: i18n.ts.username,
}); });
if (canceled1) return; if (canceled1 || username == null) return;
const { canceled: canceled2, result: password } = await os.inputText({ const { canceled: canceled2, result: password } = await os.inputText({
title: i18n.ts.password, title: i18n.ts.password,
type: 'password', type: 'password',
}); });
if (canceled2) return; if (canceled2 || password == null) return;
os.apiWithDialog('admin/accounts/create', { os.apiWithDialog('admin/accounts/create', {
username: username, username: username,
password: password, password: password,
}).then(res => { }).then(res => {
paginationComponent.value.reload(); paginationComponent.value?.reload();
}); });
} }

View File

@ -55,13 +55,13 @@ const pagination = {
function accept(user) { function accept(user) {
misskeyApi('following/requests/accept', { userId: user.id }).then(() => { misskeyApi('following/requests/accept', { userId: user.id }).then(() => {
paginationComponent.value.reload(); paginationComponent.value?.reload();
}); });
} }
function reject(user) { function reject(user) {
misskeyApi('following/requests/reject', { userId: user.id }).then(() => { misskeyApi('following/requests/reject', { userId: user.id }).then(() => {
paginationComponent.value.reload(); paginationComponent.value?.reload();
}); });
} }

View File

@ -77,15 +77,15 @@ async function create() {
clipsCache.delete(); clipsCache.delete();
pagingComponent.value.reload(); pagingComponent.value?.reload();
} }
function onClipCreated() { function onClipCreated() {
pagingComponent.value.reload(); pagingComponent.value?.reload();
} }
function onClipDeleted() { function onClipDeleted() {
pagingComponent.value.reload(); pagingComponent.value?.reload();
} }
const headerActions = computed(() => []); const headerActions = computed(() => []);

View File

@ -110,7 +110,7 @@ function addUser() {
listId: list.value.id, listId: list.value.id,
userId: user.id, userId: user.id,
}).then(() => { }).then(() => {
paginationEl.value.reload(); paginationEl.value?.reload();
}); });
}); });
} }
@ -126,7 +126,7 @@ async function removeUser(item, ev) {
listId: list.value.id, listId: list.value.id,
userId: item.userId, userId: item.userId,
}).then(() => { }).then(() => {
paginationEl.value.removeItem(item.id); paginationEl.value?.removeItem(item.id);
}); });
}, },
}], ev.currentTarget ?? ev.target); }], ev.currentTarget ?? ev.target);

View File

@ -138,12 +138,13 @@ const token = ref<string | number | null>(null);
const backupCodes = ref<string[]>(); const backupCodes = ref<string[]>();
function cancel() { function cancel() {
dialog.value.close(); dialog.value?.close();
} }
async function tokenDone() { async function tokenDone() {
if (token.value == null) return;
const res = await os.apiWithDialog('i/2fa/done', { const res = await os.apiWithDialog('i/2fa/done', {
token: token.value.toString(), token: typeof token.value === 'string' ? token.value : token.value.toString(),
}); });
backupCodes.value = res.backupCodes; backupCodes.value = res.backupCodes;
@ -166,7 +167,7 @@ function downloadBackupCodes() {
} }
function allDone() { function allDone() {
dialog.value.close(); dialog.value?.close();
} }
</script> </script>

View File

@ -55,6 +55,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import FormPagination from '@/components/MkPagination.vue'; import FormPagination from '@/components/MkPagination.vue';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -77,7 +78,7 @@ const pagination = {
function revoke(token) { function revoke(token) {
misskeyApi('i/revoke-token', { tokenId: token.id }).then(() => { misskeyApi('i/revoke-token', { tokenId: token.id }).then(() => {
list.value.reload(); list.value?.reload();
}); });
} }

View File

@ -108,7 +108,7 @@ const decorationsForPreview = computed(() => {
}); });
function cancel() { function cancel() {
dialog.value.close(); dialog.value?.close();
} }
async function update() { async function update() {
@ -118,7 +118,7 @@ async function update() {
offsetX: offsetX.value, offsetX: offsetX.value,
offsetY: offsetY.value, offsetY: offsetY.value,
}); });
dialog.value.close(); dialog.value?.close();
} }
async function attach() { async function attach() {
@ -128,12 +128,12 @@ async function attach() {
offsetX: offsetX.value, offsetX: offsetX.value,
offsetY: offsetY.value, offsetY: offsetY.value,
}); });
dialog.value.close(); dialog.value?.close();
} }
async function detach() { async function detach() {
emit('detach'); emit('detach');
dialog.value.close(); dialog.value?.close();
} }
</script> </script>