diff options
Diffstat (limited to 'packages/frontend/src/pages/gallery/edit.vue')
| -rw-r--r-- | packages/frontend/src/pages/gallery/edit.vue | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/packages/frontend/src/pages/gallery/edit.vue b/packages/frontend/src/pages/gallery/edit.vue index f3cbd4947c..5761e8e32c 100644 --- a/packages/frontend/src/pages/gallery/edit.vue +++ b/packages/frontend/src/pages/gallery/edit.vue @@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { computed, watch } from 'vue'; +import { computed, watch, ref } from 'vue'; import MkButton from '@/components/MkButton.vue'; import MkInput from '@/components/MkInput.vue'; import MkTextarea from '@/components/MkTextarea.vue'; @@ -56,38 +56,38 @@ const props = defineProps<{ postId?: string; }>(); -let init = $ref(null); -let files = $ref([]); -let description = $ref(null); -let title = $ref(null); -let isSensitive = $ref(false); +const init = ref(null); +const files = ref([]); +const description = ref(null); +const title = ref(null); +const isSensitive = ref(false); function selectFile(evt) { selectFiles(evt.currentTarget ?? evt.target, null).then(selected => { - files = files.concat(selected); + files.value = files.value.concat(selected); }); } function remove(file) { - files = files.filter(f => f.id !== file.id); + files.value = files.value.filter(f => f.id !== file.id); } async function save() { if (props.postId) { await os.apiWithDialog('gallery/posts/update', { postId: props.postId, - title: title, - description: description, - fileIds: files.map(file => file.id), - isSensitive: isSensitive, + title: title.value, + description: description.value, + fileIds: files.value.map(file => file.id), + isSensitive: isSensitive.value, }); router.push(`/gallery/${props.postId}`); } else { const created = await os.apiWithDialog('gallery/posts/create', { - title: title, - description: description, - fileIds: files.map(file => file.id), - isSensitive: isSensitive, + title: title.value, + description: description.value, + fileIds: files.value.map(file => file.id), + isSensitive: isSensitive.value, }); router.push(`/gallery/${created.id}`); } @@ -106,19 +106,19 @@ async function del() { } watch(() => props.postId, () => { - init = () => props.postId ? os.api('gallery/posts/show', { + init.value = () => props.postId ? os.api('gallery/posts/show', { postId: props.postId, }).then(post => { - files = post.files; - title = post.title; - description = post.description; - isSensitive = post.isSensitive; + files.value = post.files; + title.value = post.title; + description.value = post.description; + isSensitive.value = post.isSensitive; }) : Promise.resolve(null); }, { immediate: true }); -const headerActions = $computed(() => []); +const headerActions = computed(() => []); -const headerTabs = $computed(() => []); +const headerTabs = computed(() => []); definePageMetadata(computed(() => props.postId ? { title: i18n.ts.edit, |