aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/services/ui/ldItemResourceUrl.ts
blob: 7db7ab9b53e7fd048ac941a08636e18b12790ebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { Item } from '@/@types/gallery';
import { useGalleryStore } from '@/store/galleryStore';
import { computed } from 'vue';
import { isDownloadableItem } from '../itemGuards';

export const useItemResource = (item: Item) => {
  const galleryStore = useGalleryStore();
  const itemResourceUrl = computed(() => isDownloadableItem(item) ? galleryStore.resourceRoot + item.properties.resource : '');
  const thumbnailResourceUrl = computed(() => item.thumbnail ? galleryStore.resourceRoot + item.thumbnail.resource : '');

  return {
    itemResourceUrl,
    thumbnailResourceUrl,
  };
};