Skip to content

Commit

Permalink
Improved: logic for returning boolean for whether facility already ex…
Browse files Browse the repository at this point in the history
…ists (hotwax#185)
  • Loading branch information
amansinghbais committed Feb 19, 2024
1 parent fc1373d commit da44982
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/CreateVirtualFacilityModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default defineComponent({
(this as any).$refs.facilityId.$el.classList.add('ion-touched');
},
async isFacilityAlreadyExists() {
let facilitiesCount = 0;
let isFacilityExists = false;
try {
const resp = await FacilityService.fetchFacilities({
Expand All @@ -189,15 +189,15 @@ export default defineComponent({
})
if (!hasError(resp)) {
facilitiesCount = resp.data.docs.length
isFacilityExists = resp.data.docs.length ? true : false
} else {
throw resp.data
}
} catch(err) {
logger.error(err)
}
return facilitiesCount > 0
return isFacilityExists
}
},
setup() {
Expand Down

0 comments on commit da44982

Please sign in to comment.