refactor
This commit is contained in:
parent
e7a185e2c4
commit
21bfddf755
|
@ -99,19 +99,19 @@ async function addUser() {
|
|||
const { canceled: canceled1, result: username } = await os.inputText({
|
||||
title: i18n.ts.username,
|
||||
});
|
||||
if (canceled1) return;
|
||||
if (canceled1 || username == null) return;
|
||||
|
||||
const { canceled: canceled2, result: password } = await os.inputText({
|
||||
title: i18n.ts.password,
|
||||
type: 'password',
|
||||
});
|
||||
if (canceled2) return;
|
||||
if (canceled2 || password == null) return;
|
||||
|
||||
os.apiWithDialog('admin/accounts/create', {
|
||||
username: username,
|
||||
password: password,
|
||||
}).then(res => {
|
||||
paginationComponent.value.reload();
|
||||
paginationComponent.value?.reload();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -55,13 +55,13 @@ const pagination = {
|
|||
|
||||
function accept(user) {
|
||||
misskeyApi('following/requests/accept', { userId: user.id }).then(() => {
|
||||
paginationComponent.value.reload();
|
||||
paginationComponent.value?.reload();
|
||||
});
|
||||
}
|
||||
|
||||
function reject(user) {
|
||||
misskeyApi('following/requests/reject', { userId: user.id }).then(() => {
|
||||
paginationComponent.value.reload();
|
||||
paginationComponent.value?.reload();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -77,15 +77,15 @@ async function create() {
|
|||
|
||||
clipsCache.delete();
|
||||
|
||||
pagingComponent.value.reload();
|
||||
pagingComponent.value?.reload();
|
||||
}
|
||||
|
||||
function onClipCreated() {
|
||||
pagingComponent.value.reload();
|
||||
pagingComponent.value?.reload();
|
||||
}
|
||||
|
||||
function onClipDeleted() {
|
||||
pagingComponent.value.reload();
|
||||
pagingComponent.value?.reload();
|
||||
}
|
||||
|
||||
const headerActions = computed(() => []);
|
||||
|
|
|
@ -110,7 +110,7 @@ function addUser() {
|
|||
listId: list.value.id,
|
||||
userId: user.id,
|
||||
}).then(() => {
|
||||
paginationEl.value.reload();
|
||||
paginationEl.value?.reload();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ async function removeUser(item, ev) {
|
|||
listId: list.value.id,
|
||||
userId: item.userId,
|
||||
}).then(() => {
|
||||
paginationEl.value.removeItem(item.id);
|
||||
paginationEl.value?.removeItem(item.id);
|
||||
});
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
|
|
|
@ -138,12 +138,13 @@ const token = ref<string | number | null>(null);
|
|||
const backupCodes = ref<string[]>();
|
||||
|
||||
function cancel() {
|
||||
dialog.value.close();
|
||||
dialog.value?.close();
|
||||
}
|
||||
|
||||
async function tokenDone() {
|
||||
if (token.value == null) return;
|
||||
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;
|
||||
|
@ -166,7 +167,7 @@ function downloadBackupCodes() {
|
|||
}
|
||||
|
||||
function allDone() {
|
||||
dialog.value.close();
|
||||
dialog.value?.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import FormPagination from '@/components/MkPagination.vue';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
@ -77,7 +78,7 @@ const pagination = {
|
|||
|
||||
function revoke(token) {
|
||||
misskeyApi('i/revoke-token', { tokenId: token.id }).then(() => {
|
||||
list.value.reload();
|
||||
list.value?.reload();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ const decorationsForPreview = computed(() => {
|
|||
});
|
||||
|
||||
function cancel() {
|
||||
dialog.value.close();
|
||||
dialog.value?.close();
|
||||
}
|
||||
|
||||
async function update() {
|
||||
|
@ -118,7 +118,7 @@ async function update() {
|
|||
offsetX: offsetX.value,
|
||||
offsetY: offsetY.value,
|
||||
});
|
||||
dialog.value.close();
|
||||
dialog.value?.close();
|
||||
}
|
||||
|
||||
async function attach() {
|
||||
|
@ -128,12 +128,12 @@ async function attach() {
|
|||
offsetX: offsetX.value,
|
||||
offsetY: offsetY.value,
|
||||
});
|
||||
dialog.value.close();
|
||||
dialog.value?.close();
|
||||
}
|
||||
|
||||
async function detach() {
|
||||
emit('detach');
|
||||
dialog.value.close();
|
||||
dialog.value?.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue