app/javascript/vue/tasks/otu/browse/store/actions/loadCollectionObjects.js
import { CollectionObject } from '@/routes/endpoints'
import { MutationNames } from '../mutations/mutations'
export default ({ state, commit }, otuId) =>
new Promise((resolve, reject) => {
CollectionObject.all({
otu_id: otuId,
current_determinations: true,
extend: ['citations', 'source']
}).then(
(response) => {
state.loadState.collectionObjects = false
commit(
MutationNames.SetCollectionObjects,
state.collectionObjects.concat(response.body)
)
resolve(response)
},
(error) => {
reject(error)
}
)
})