Skip to content

Commit

Permalink
Improved: logic for adding and removing groups from association with …
Browse files Browse the repository at this point in the history
…facilityGroupTypes
  • Loading branch information
amansinghbais committed Dec 19, 2023
1 parent 3984007 commit a625bd0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/components/CreateFacilityGroupModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export default defineComponent({
}
const updatedFacilityGroups = [...this.groups, createdGroup]
await this.store.dispatch('facility/updateFacilityGroups', updatedFacilityGroups)
await this.store.dispatch('util/fetchFacilityGroupTypes')
} else {
throw resp.data;
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/util/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const getters: GetterTree<UtilState, RootState> = {
return state.facilityTypes
},
getFacilityGroupTypes(state) {
return state.facilityGroupTypes ? JSON.parse(JSON.stringify(state.facilityGroupTypes)) : {}
return state.facilityGroupTypes
},
getLocationTypes(state) {
return state.locationTypes
Expand Down
2 changes: 1 addition & 1 deletion src/views/FindGroups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export default defineComponent({
const groupsToAdd = selectedGroups.filter((selectedGroupId: string) => !prevAssociatedGroups.includes(selectedGroupId))
const groupsToRemove = prevAssociatedGroups.filter((prevGroupId: string) => !selectedGroups.includes(prevGroupId))
if(!groupsToAdd.length && !groupsToAdd.length) {
if(!(groupsToAdd.length || groupsToRemove.length)) {
return;
}
Expand Down

0 comments on commit a625bd0

Please sign in to comment.