diff options
Diffstat (limited to 'viewer/src/services/ui/ldItemResourceUrl.ts')
-rw-r--r-- | viewer/src/services/ui/ldItemResourceUrl.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/viewer/src/services/ui/ldItemResourceUrl.ts b/viewer/src/services/ui/ldItemResourceUrl.ts new file mode 100644 index 0000000..7db7ab9 --- /dev/null +++ b/viewer/src/services/ui/ldItemResourceUrl.ts | |||
@@ -0,0 +1,15 @@ | |||
1 | import { Item } from '@/@types/gallery'; | ||
2 | import { useGalleryStore } from '@/store/galleryStore'; | ||
3 | import { computed } from 'vue'; | ||
4 | import { isDownloadableItem } from '../itemGuards'; | ||
5 | |||
6 | export const useItemResource = (item: Item) => { | ||
7 | const galleryStore = useGalleryStore(); | ||
8 | const itemResourceUrl = computed(() => isDownloadableItem(item) ? galleryStore.resourceRoot + item.properties.resource : ''); | ||
9 | const thumbnailResourceUrl = computed(() => item.thumbnail ? galleryStore.resourceRoot + item.thumbnail.resource : ''); | ||
10 | |||
11 | return { | ||
12 | itemResourceUrl, | ||
13 | thumbnailResourceUrl, | ||
14 | }; | ||
15 | }; | ||