From 45c12e50ee71c2dccbf68b769f9267919f1b2102 Mon Sep 17 00:00:00 2001 From: vivek kasture Date: Tue, 15 Oct 2024 12:42:18 +0530 Subject: [PATCH] Issue #PS-000 fix: Added fieldId for block and district --- src/pages/block.tsx | 4 ++-- src/pages/district.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/block.tsx b/src/pages/block.tsx index 958ec1dc..2e064a63 100644 --- a/src/pages/block.tsx +++ b/src/pages/block.tsx @@ -94,7 +94,7 @@ const Block: React.FC = () => { const [editState, setEditState] = useState(null); const [selectedStateForEdit, setSelectedStateForEdit] = useState(null); - const [blocksFieldId, setBlocksFieldId] = useState(""); + const [blocksFieldId, setBlocksFieldId] = useState("4aab68ae-8382-43aa-a45a-e9b239319857"); const [districtFieldId, setDistrictFieldId] = useState(""); const [sortBy, setSortBy] = useState<[string, string]>(["name", "asc"]); const [paginationCount, setPaginationCount] = useState(0); @@ -299,7 +299,7 @@ const Block: React.FC = () => { const blockCodeArray = blocks.map((item: any) => item.value); setBlockCodeArr(blockCodeArray); - const blockFieldID = response?.result?.fieldId || ""; + const blockFieldID = response?.result?.fieldId || "4aab68ae-8382-43aa-a45a-e9b239319857"; setBlocksFieldId(blockFieldID); } catch (error) { console.error("Error fetching blocks", error); diff --git a/src/pages/district.tsx b/src/pages/district.tsx index dae0a49a..f44720e4 100644 --- a/src/pages/district.tsx +++ b/src/pages/district.tsx @@ -68,7 +68,7 @@ const District: React.FC = () => { useState(null); const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false); - const [districtFieldId, setDistrictFieldId] = useState(""); + const [districtFieldId, setDistrictFieldId] = useState("b61edfc6-3787-4079-86d3-37262bf23a9e"); const [loading, setLoading] = useState(false); const [selectedSort, setSelectedSort] = useState("Sort"); const [pageCount, setPageCount] = useState(Numbers.ONE); @@ -147,7 +147,7 @@ const District: React.FC = () => { const districtCodeArray = districts.map((item: any) => item.value); setDistrictCodeArr(districtCodeArray); - const districtFieldID = data?.result?.fieldId || ""; + const districtFieldID = data?.result?.fieldId || "b61edfc6-3787-4079-86d3-37262bf23a9e"; setDistrictFieldId(districtFieldID); } catch (error) { console.error("Error fetching districts", error); @@ -446,7 +446,7 @@ const District: React.FC = () => { if (cohortCreateResponse) { filteredCohortOptionData(); showToastMessage(t("COMMON.DISTRICT_ADDED_SUCCESS"), "success"); - } else if (cohortCreateResponse.responseCode === 409) { + } else if (cohortCreateResponse?.responseCode === 409) { showToastMessage(t("COMMON.DISTRICT_DUPLICATION_FAILURE"), "error"); } } catch (error) {