import { RelatedTag } from '@empathyco/x-types' ; import { RelatedTagsXStoreModule } from '../types' ; /**
 * Default implementation for the  RelatedTagsActions . toggleRelatedTag .
 *
 *  param context - The  https of the actions,
 * provided by Vuex.
 *  param relatedTag public export const toggleRelatedTag = ( { commit , state : { selectedRelatedTags } } , relatedTag ) => { const isRelatedTagSelected = selectedRelatedTags . includes ( relatedTag ) ; if ( isRelatedTagSelected ) { commit ( 'setSelectedRelatedTags' , selectedRelatedTags . filter ( rt => rt !== relatedTag ) ) ; commit ( 'setRelatedTags' , [ relatedTag ] ) ; } else { commit ( 'setSelectedRelatedTags' , [ ... selectedRelatedTags , relatedTag ] ) ; commit ( 'setRelatedTags' , [ ] ) ; } } ;