refactor(frontend): Reactivityで型を明示するように (#12791)

* refactor(frontend): Reactivityで型を明示するように

* fix: プロパティの参照が誤っているのを修正

* fix: 初期化の値を空配列に書き換えていた部分をnullに置き換え
This commit is contained in:
zyoshoka
2023-12-26 14:19:35 +09:00
committed by GitHub
parent a9b42765f9
commit 75034d9240
110 changed files with 370 additions and 344 deletions

View File

@@ -39,6 +39,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue';
@@ -56,10 +57,10 @@ const props = defineProps<{
postId?: string;
}>();
const init = ref(null);
const files = ref([]);
const description = ref(null);
const title = ref(null);
const init = ref<(() => Promise<any>) | null>(null);
const files = ref<Misskey.entities.DriveFile[]>([]);
const description = ref<string | null>(null);
const title = ref<string | null>(null);
const isSensitive = ref(false);
function selectFile(evt) {
@@ -109,7 +110,7 @@ watch(() => props.postId, () => {
init.value = () => props.postId ? os.api('gallery/posts/show', {
postId: props.postId,
}).then(post => {
files.value = post.files;
files.value = post.files ?? [];
title.value = post.title;
description.value = post.description;
isSensitive.value = post.isSensitive;