From cfbff75f78963e3d24326f731590e78a4d719e9e Mon Sep 17 00:00:00 2001 From: Zéro~Informatique Date: Sun, 6 Nov 2022 19:34:26 +0100 Subject: viewer/command: add item download button Fixed a reactivity issue with props used in a composition function (useItemResource) Fixed crash with null items in LayoutTop Changed how downloadable items are identified: We use the fact they are materialized in the gallery instead of a hardly defined "listing condition". This also simplifies the code. --- viewer/src/services/ui/ldItemResourceUrl.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'viewer/src/services/ui/ldItemResourceUrl.ts') diff --git a/viewer/src/services/ui/ldItemResourceUrl.ts b/viewer/src/services/ui/ldItemResourceUrl.ts index 7db7ab9..d6734b3 100644 --- a/viewer/src/services/ui/ldItemResourceUrl.ts +++ b/viewer/src/services/ui/ldItemResourceUrl.ts @@ -1,12 +1,12 @@ import { Item } from '@/@types/gallery'; import { useGalleryStore } from '@/store/galleryStore'; -import { computed } from 'vue'; +import { computed, ToRef } from 'vue'; import { isDownloadableItem } from '../itemGuards'; -export const useItemResource = (item: Item) => { +export const useItemResource = (item: ToRef) => { const galleryStore = useGalleryStore(); - const itemResourceUrl = computed(() => isDownloadableItem(item) ? galleryStore.resourceRoot + item.properties.resource : ''); - const thumbnailResourceUrl = computed(() => item.thumbnail ? galleryStore.resourceRoot + item.thumbnail.resource : ''); + const itemResourceUrl = computed(() => isDownloadableItem(item.value) ? galleryStore.resourceRoot + item.value.properties.resource : ''); + const thumbnailResourceUrl = computed(() => item.value.thumbnail ? galleryStore.resourceRoot + item.value.thumbnail.resource : ''); return { itemResourceUrl, -- cgit v1.2.3