Skip to content

Commit

Permalink
error message when no file is added
Browse files Browse the repository at this point in the history
  • Loading branch information
mithunhegde-egov committed Oct 1, 2024
1 parent 4d26203 commit 644fd02
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const TenantConfigUpload = () => {
const [isError, setIsError] = useState(false);
const [uploadData, setUploadData] = useState([]); // State to store the uploaded data
const [tenantDocument, setDocuments] = useState([]);
const [canSubmit, setCanSubmit] = useState(false);



const mutation = Digit.Hooks.useCustomAPIMutationHook({
Expand Down Expand Up @@ -74,6 +76,17 @@ const TenantConfigUpload = () => {
type: data[key]?.type,
};
});

const isBannerUndefined = documents.find(doc => doc.type === "bannerUrl")?.fileStoreId === undefined;
const isLogoUndefined = documents.find(doc => doc.type === "logoUrl")?.fileStoreId === undefined;

if (isBannerUndefined && isLogoUndefined) {
setToastMessage(t("BOTH_FILESTOREIDS_ARE_UNDEFINED"));
setIsError(true);
setShowToast(true);
return;
}

setUploadData(documents);
};

Expand Down

0 comments on commit 644fd02

Please sign in to comment.