From cee7372a264ac76c5eb60c73be1d7ca253924a82 Mon Sep 17 00:00:00 2001 From: jlpereira Date: Thu, 5 Dec 2024 16:41:11 -0300 Subject: [PATCH] Add sort_order to PanelGallery --- .../otus/components/Panel/PanelGallery/PanelGallery.vue | 9 +++++++-- src/modules/otus/store/useImageStore.js | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modules/otus/components/Panel/PanelGallery/PanelGallery.vue b/src/modules/otus/components/Panel/PanelGallery/PanelGallery.vue index ec4196ce..26a5cefd 100644 --- a/src/modules/otus/components/Panel/PanelGallery/PanelGallery.vue +++ b/src/modules/otus/components/Panel/PanelGallery/PanelGallery.vue @@ -14,6 +14,11 @@ const props = defineProps({ otuId: { type: [String, Number], required: true + }, + + sort_order: { + type: [Array], + default: () => [] } }) @@ -21,12 +26,12 @@ const store = useImageStore() const images = computed(() => store.images || []) onServerPrefetch(async () => { - await store.loadImages(props.otuId) + await store.loadImages(props.otuId, { sortOrder: props.sortOrder }) }) onMounted(() => { if (!store.images) { - store.loadImages(props.otuId) + store.loadImages(props.otuId, { sortOrder: props.sort_order }) } }) diff --git a/src/modules/otus/store/useImageStore.js b/src/modules/otus/store/useImageStore.js index 055c343f..17a491aa 100644 --- a/src/modules/otus/store/useImageStore.js +++ b/src/modules/otus/store/useImageStore.js @@ -16,10 +16,11 @@ export const useImageStore = defineStore('imageStore', { this.controller?.abort() }, - async loadImages(otuId) { + async loadImages(otuId, { sortOrder }) { const params = { extend: ['depictions', 'attribution', 'source', 'citations'], - otu_scope: ['all', 'coordinate_otus'] + otu_scope: ['all', 'coordinate_otus'], + sort_order: sortOrder } this.controller = new AbortController()