Skip to content

Commit

Permalink
Merge pull request #248 from SpeciesFileGroup/development
Browse files Browse the repository at this point in the history
Add sort_order to PanelGallery
  • Loading branch information
jlpereira authored Dec 5, 2024
2 parents 2cace3d + cee7372 commit af3820e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,24 @@ const props = defineProps({
otuId: {
type: [String, Number],
required: true
},
sort_order: {
type: [Array],
default: () => []
}
})
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 })
}
})
Expand Down
5 changes: 3 additions & 2 deletions src/modules/otus/store/useImageStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit af3820e

Please sign in to comment.