diff --git a/src/components/Gallery/GalleryCarousel/GalleryCarousel.global.vue b/src/components/Gallery/GalleryCarousel/GalleryCarousel.global.vue
index 0a500c5..f8f1eed 100644
--- a/src/components/Gallery/GalleryCarousel/GalleryCarousel.global.vue
+++ b/src/components/Gallery/GalleryCarousel/GalleryCarousel.global.vue
@@ -5,10 +5,10 @@
>
@@ -37,8 +37,8 @@
diff --git a/src/components/Gallery/useGallery.js b/src/components/Gallery/useGallery.js
new file mode 100644
index 0000000..8493b40
--- /dev/null
+++ b/src/components/Gallery/useGallery.js
@@ -0,0 +1,49 @@
+import { ref, watch } from 'vue'
+import { makeAPIRequest } from '@/utils'
+
+export function useGallery({ props }) {
+ const depictions = ref([])
+
+ function makeGalleryImage(depiction) {
+ return {
+ id: depiction.id,
+ objectId: depiction.depiction_object_id,
+ objectType: depiction.depiction_object_type,
+ objectLabel: depiction.depiction_object.label,
+ label: depiction.label,
+ imageOriginal: depiction.image.original,
+ imageMedium: depiction.image.medium,
+ attribution: depiction.attribution?.label || '',
+ labelAttribution: [
+ depiction.depiction_object.label,
+ depiction.attribution?.label || ''
+ ].join(' ')
+ }
+ }
+
+ watch(
+ () => props.depictionId,
+ (ids) => {
+ if (ids.length) {
+ makeAPIRequest
+ .get('/depictions/gallery', {
+ params: { depiction_id: ids }
+ })
+ .then(({ data }) => {
+ depictions.value = data
+ .map(makeGalleryImage)
+ .sort(
+ (a, b) =>
+ props.depictionId.indexOf(a.id) -
+ props.depictionId.indexOf(b.id)
+ )
+ })
+ }
+ },
+ { immediate: true }
+ )
+
+ return {
+ depictions
+ }
+}