diff --git a/microfrontends/SignDocuments/src/Component/component/emailComponent.js b/microfrontends/SignDocuments/src/Component/component/emailComponent.js index 9ae70a8da..99b44872d 100644 --- a/microfrontends/SignDocuments/src/Component/component/emailComponent.js +++ b/microfrontends/SignDocuments/src/Component/component/emailComponent.js @@ -20,14 +20,14 @@ function EmailComponent({ pdfName, sender }) { - const [emailCount, setEmailCount] = useState([]); + const [emailList, setEmailList] = useState([]); const [emailValue, setEmailValue] = useState(); const [isLoading, setIsLoading] = useState(false); //function for send email const sendEmail = async () => { setIsLoading(true); let sendMail; - for (let i = 0; i < emailCount.length; i++) { + for (let i = 0; i < emailList.length; i++) { try { const imgPng = "https://qikinnovation.ams3.digitaloceanspaces.com/logo.png"; @@ -44,7 +44,7 @@ function EmailComponent({ let params = { pdfName: pdfName, url: pdfUrl, - recipient: emailCount[i], + recipient: emailList[i], subject: `${sender.name} has signed the doc - ${pdfName}`, from: sender.email, html: @@ -69,7 +69,7 @@ function EmailComponent({ if (sendMail.data.result.status === "success") { setIsEmail(false); setEmailValue(""); - setEmailCount(""); + setEmailList([]); setSuccessEmail(true); setTimeout(() => { setSuccessEmail(false); @@ -87,8 +87,8 @@ function EmailComponent({ //function for remove email const removeChip = (index) => { - const updateEmailCount = emailCount.filter((data, key) => key !== index); - setEmailCount(updateEmailCount); + const updateEmailCount = emailList.filter((data, key) => key !== index); + setEmailList(updateEmailCount); }; //function for get email value const handleEmailValue = (e) => { @@ -99,10 +99,10 @@ function EmailComponent({ //function for save email in array after press enter const handleEnterPress = (e) => { if (e.key === "Enter" && emailValue) { - setEmailCount((prev) => [...prev, emailValue]); + setEmailList((prev) => [...prev, emailValue]); setEmailValue(""); } else if (e === "add" && emailValue) { - setEmailCount((prev) => [...prev, emailValue]); + setEmailList((prev) => [...prev, emailValue]); setEmailValue(""); } }; @@ -253,7 +253,7 @@ function EmailComponent({ > Recipients added here will get a copy of the signed document.

- {emailCount.length > 0 ? ( + {emailList.length > 0 ? ( <>
- {emailCount.map((data, ind) => { + {emailList.map((data, ind) => { return (
- {emailCount.length <= 9 && ( + {emailList.length <= 9 && ( { setIsEmail(false); setEmailValue(""); - setEmailCount(""); + setEmailList([]); }} > Close