From d0a410f35cae11380b2611b34bca7696a7a7b427 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Tue, 10 Oct 2023 21:42:02 +0530 Subject: [PATCH] feat:edit-ecosystem-modal Signed-off-by: pranalidhanavade --- src/components/EditEcosystemOrgModal/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/EditEcosystemOrgModal/index.tsx b/src/components/EditEcosystemOrgModal/index.tsx index 36f528393..83deaab22 100644 --- a/src/components/EditEcosystemOrgModal/index.tsx +++ b/src/components/EditEcosystemOrgModal/index.tsx @@ -63,6 +63,7 @@ const EditPopupModal = (props: EditEntityModalProps) => { const [errMsg, setErrMsg] = useState(null); const [imgError, setImgError] = useState(''); + useEffect(() => { if (!props.openModal) { setInitialEntityData({ @@ -145,13 +146,11 @@ const EditPopupModal = (props: EditEntityModalProps) => { } }; - // Function to check if an object is empty const isEmpty = (object: any): boolean => { return true; }; - // Function to submit update operation const submitUpdateEntity = async (values: EditEntityValues) => { setLoading(true); @@ -178,7 +177,7 @@ const EditPopupModal = (props: EditEntityModalProps) => { } else { const response = await updateEcosystem(entityData); const { data } = response as AxiosResponse; - + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { if (props?.onEditSuccess) { props?.onEditSuccess(); @@ -200,7 +199,10 @@ const EditPopupModal = (props: EditEntityModalProps) => { imagePreviewUrl: "", fileName: '' }); - setInitialEntityData(initialEntityData); + setInitialEntityData({ + name: "", + description: "", + }); props.setOpenModal(false); }}> Edit {props.isOrganization ? "Organization" : "Ecosystem"}