diff --git a/src/Components/ExternalResult/FacilitiesSelectDialogue.tsx b/src/Components/ExternalResult/FacilitiesSelectDialogue.tsx
index 03f6e92d72f..4dfe8850272 100644
--- a/src/Components/ExternalResult/FacilitiesSelectDialogue.tsx
+++ b/src/Components/ExternalResult/FacilitiesSelectDialogue.tsx
@@ -34,12 +34,12 @@ const FacilitiesSelectDialog = (props: Props) => {
district={
authUser?.user_type === "DistrictAdmin"
? authUser?.district?.toString()
- : ""
+ : undefined
}
state={
authUser?.user_type === "StateAdmin"
? authUser?.state?.toString()
- : ""
+ : undefined
}
/>
diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx
index 018b0d1101f..f03793fd1d5 100644
--- a/src/Components/Patient/PatientRegister.tsx
+++ b/src/Components/Patient/PatientRegister.tsx
@@ -1063,25 +1063,27 @@ export const PatientRegister = (props: PatientRegisterProps) => {
}
const PatientRegisterAuth = () => {
- let check = false;
const showAllFacilityUsers = ["DistrictAdmin", "StateAdmin"];
if (
!showAllFacilityUsers.includes(authUser.user_type) &&
authUser.home_facility_object?.id === facilityId
) {
- check = true;
- } else if (
+ return true;
+ }
+ if (
authUser.user_type === "DistrictAdmin" &&
authUser.district === facilityObject?.district
) {
- check = true;
- } else if (
+ return true;
+ }
+ if (
authUser.user_type === "StateAdmin" &&
authUser.state === facilityObject?.state
) {
- check = true;
+ return true;
}
- return check;
+
+ return false;
};
if (!isLoading && facilityId && facilityObject && !PatientRegisterAuth()) {