diff --git a/src/Components/Facility/FacilityCreate.tsx b/src/Components/Facility/FacilityCreate.tsx index 584d577dcb1..e9547d5dddd 100644 --- a/src/Components/Facility/FacilityCreate.tsx +++ b/src/Components/Facility/FacilityCreate.tsx @@ -366,7 +366,7 @@ export const FacilityCreate = (props: FacilityProps) => { if (!fetchedDistricts) return; const matchedDistrict = fetchedDistricts.find((district) => { - return includesIgnoreCase(district.name, pincodeDetails.district); + return includesIgnoreCase(district.name, pincodeDetails.districtname); }); if (!matchedDistrict) return; diff --git a/src/Utils/utils.ts b/src/Utils/utils.ts index 90e6b323db7..df6bd46d131 100644 --- a/src/Utils/utils.ts +++ b/src/Utils/utils.ts @@ -214,13 +214,14 @@ export const parseCsvFile = async ( export const getPincodeDetails = async (pincode: string, apiKey: string) => { const response = await fetch( - `https://api.data.gov.in/resource/5c2f62fe-5afa-4119-a499-fec9d604d5bd?api-key=${apiKey}&format=json&filters[pincode]=${pincode}&limit=1` + `https://api.data.gov.in/resource/6176ee09-3d56-4a3b-8115-21841576b2f6?api-key=${apiKey}&format=json&filters[pincode]=${pincode}&limit=1` ); const data = await response.json(); return data.records[0]; }; export const includesIgnoreCase = (str1: string, str2: string) => { + if (!str1 || !str2) return false; const lowerCaseStr1 = str1.toLowerCase(); const lowerCaseStr2 = str2.toLowerCase(); return (