Skip to content

Commit

Permalink
Merge pull request #184 from SpeciesFileGroup/development
Browse files Browse the repository at this point in the history
Update type designation panel
  • Loading branch information
jlpereira authored Oct 30, 2023
2 parents b9c4a0d + 23830d1 commit 383c6f2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
</template>

<script setup>
import { ref, watch, computed } from 'vue'
import { useOtuPageRequest } from '@/modules/otus/helpers/useOtuPageRequest'
import { computed } from 'vue'
import { useOtuStore } from '@/modules/otus/store/store'
import PanelDropdown from '../PanelDropdown.vue'
import TaxonWorks from '../../../services/TaxonWorks'
const props = defineProps({
taxonId: {
Expand All @@ -23,27 +22,16 @@ const props = defineProps({
}
})
const typeDesignation = ref({})
const store = useOtuStore()
const typeDesignation = computed(
() => store.taxon?.type_taxon_name_relationship || {}
)
const typeDesignationLabel = computed(() =>
[
typeDesignation.value.subject_object_tag || '',
typeDesignation.value.subject_status_tag || '',
typeDesignation.value.object_object_tag || ''
].join(' ')
)
watch(
() => props.taxonId,
async () => {
if (!props.taxonId) {
return
}
useOtuPageRequest('panel:type', () =>
TaxonWorks.getTaxonTypeDesignation(props.taxonId)
).then(({ data }) => {
typeDesignation.value = data.type_taxon_name_relationship || {}
})
},
{ immediate: true }
)
</script>
3 changes: 0 additions & 3 deletions src/modules/otus/store/actions/index.js

This file was deleted.

11 changes: 7 additions & 4 deletions src/modules/otus/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ export const useOtuStore = defineStore('otuStore', {
},
actions: {
async loadTaxon(id, { signal }) {
const taxon = await useOtuPageRequest('summary', () =>
TaxonWorks.summary(id, { signal })
)
const responses = await Promise.all([
TaxonWorks.getTaxon(id, {
params: { extend: ['type_taxon_name_relationship'] }
}),
useOtuPageRequest('summary', () => TaxonWorks.summary(id, { signal }))
])

this.taxon = taxon.data
this.taxon = Object.assign({}, ...responses.map((r) => r.data))
},
async loadOtu(id, { signal }) {
const otu = await TaxonWorks.getOtu(id, { signal })
Expand Down

0 comments on commit 383c6f2

Please sign in to comment.