diff --git a/package-lock.json b/package-lock.json index 088b652..5abda8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "firebase": "^7.8.1", "next": "^10.0.0", "next-redux-wrapper": "^6.0.2", + "nprogress": "^0.2.0", "react": "16.13.1", "react-available-times": "^1.4.0", "react-bootstrap": "^1.4.0", @@ -9797,6 +9798,11 @@ "set-blocking": "~2.0.0" } }, + "node_modules/nprogress": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz", + "integrity": "sha1-y480xTIT2JVyP8urkH6UIq28r7E=" + }, "node_modules/nth-check": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz", diff --git a/src/components/shareinvite.tsx b/src/components/shareinvite.tsx index 8315e71..67bb8b4 100644 --- a/src/components/shareinvite.tsx +++ b/src/components/shareinvite.tsx @@ -65,7 +65,7 @@ const Invitation = (props: { evt.preventDefault(); let value = currentEmail.trim(); if (value && isValid(value)) { - setEmails([...emailList, currentEmail]); + setEmails([...emailList, value]); setCurrentEmail(""); } } @@ -87,13 +87,17 @@ const Invitation = (props: { setEmails([...emailList, ...toBeAdded]); } }; + const handlePreSubmit = (): void => { + let value = currentEmail.trim(); + if (value && isValid(value)) { + setEmails([...emailList, value]); + setCurrentEmail(""); + } + handleSubmit(); + } /* added void below( remove this comment at last PR) */ const handleSubmit = async (): Promise => { /* console.log(emailList); which is also to be removed */ - if(isValid(currentEmail)) { - setEmails([...emailList, currentEmail]); - setCurrentEmail(""); - } const mailerArgs: MailerPollArgs = { pollID: pollid, pollTitle: polltitle, @@ -102,7 +106,7 @@ const Invitation = (props: { senderEmailID: loggedInUserEmailID, }; const { statusCode } = await mailerAPI.sendPollInvites(mailerArgs, token); - if (statusCode !== 404) { + if (statusCode === 200) { props.onChangeS(true); } else { props.onChangeF(true); @@ -149,7 +153,7 @@ const Invitation = (props: { onChange={handleChange} onPaste={handlePaste} /> -