diff --git a/src/components/AddFacilityGroupModal.vue b/src/components/AddFacilityGroupModal.vue index c6a36e8..e20ba73 100644 --- a/src/components/AddFacilityGroupModal.vue +++ b/src/components/AddFacilityGroupModal.vue @@ -210,12 +210,13 @@ export default defineComponent({ if(!hasError(resp) && resp.data?.docs?.length > 0) { this.filteredFacilityGroupsByType = this.facilityGroupsByType = resp.data.docs.reduce((groupsByType: any, group: any) => { - if(groupsByType[group.facilityGroupTypeId]) { - groupsByType[group.facilityGroupTypeId].push(group) + const groupTypeId = !group.facilityGroupTypeId ? "Others" : group.facilityGroupTypeId; + + if(groupsByType[groupTypeId]) { + groupsByType[groupTypeId].push(group) } else { - groupsByType[group.facilityGroupTypeId] = [group] + groupsByType[groupTypeId] = [group] } - return groupsByType }, {}) } else {