SpeciesFileGroup/taxonworks

View on GitHub
app/javascript/vue/tasks/citations/otus/store/mutations/removeOtuFormCitationList.js

Summary

Maintainability
C
1 day
Test Coverage
export default function (state, id) {
  var position = state.otu_citations.findIndex(item => {
    if (id === item.id) {
      return true
    }
  })
  if (position >= 0) {
    if (state.selected.citation.id == state.otu_citations[position].id) {
      state.selected.otu = undefined
      state.selected.source = undefined
      state.selected.citation = undefined
      state.citations = []
      state.source_citations = [],
      state.otu_citations = []
    }
    state.otu_citations.splice(position, 1)
  }
}