aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/services/ui/ldItemResourceUrl.ts
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/services/ui/ldItemResourceUrl.ts')
-rw-r--r--viewer/src/services/ui/ldItemResourceUrl.ts15
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 @@
1import { Item } from '@/@types/gallery';
2import { useGalleryStore } from '@/store/galleryStore';
3import { computed } from 'vue';
4import { isDownloadableItem } from '../itemGuards';
5
6export 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};