Skip to content

Commit

Permalink
Update UploadDataCustom.js (#1524)
Browse files Browse the repository at this point in the history
* Update UploadDataCustom.js

* Update UploadDataCustom.js
  • Loading branch information
ashish-egov authored Oct 15, 2024
1 parent 186bed2 commit 4b6f2cd
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ const UploadDataCustom = React.memo(({ formData, onSelect, ...props }) => {
console.error("Error fetching data:", error);
}
};
if(boundaryHierarchy){
if(boundaryHierarchy && downloadError){
fetchData();
}
}, [type]);
}, [type, boundaryHierarchy, downloadError]);


useEffect(() => {
Expand Down Expand Up @@ -505,7 +505,19 @@ const UploadDataCustom = React.memo(({ formData, onSelect, ...props }) => {
setSheetErrors(temp?.additionalDetails?.sheetErrors?.length || 0);
const processedFileStore = temp?.processedFilestoreId;
if (!processedFileStore) {
setShowToast({ key: "error", label: t("HCM_VALIDATION_FAILED"), transitionTime: 5000000 });
if(temp?.status=="failed" && temp?.additionalDetails?.error){
try {
const parsedError = JSON.parse(temp.additionalDetails.error);
const errorMessage = parsedError?.description || parsedError?.message || t("HCM_VALIDATION_FAILED");
setShowToast({ key: "error", label: errorMessage, transitionTime: 5000000 });
} catch (e) {
console.error("Error parsing JSON:", e);
setShowToast({ key: "error", label: t("HCM_VALIDATION_FAILED"), transitionTime: 5000000 });
}
}
else{
setShowToast({ key: "error", label: t("HCM_VALIDATION_FAILED"), transitionTime: 5000000 });
}
return;
} else {
setIsError(true);
Expand Down

0 comments on commit 4b6f2cd

Please sign in to comment.