Skip to content

Commit

Permalink
Merge pull request #46 from AthulJoshi/shareinvite-update
Browse files Browse the repository at this point in the history
minor fixes
  • Loading branch information
anandbaburajan authored Jan 30, 2021
2 parents f3c68e8 + 432187e commit 87382d0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions src/components/shareinvite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const Invitation = (props: {
evt.preventDefault();
let value = currentEmail.trim();
if (value && isValid(value)) {
setEmails([...emailList, currentEmail]);
setEmails([...emailList, value]);
setCurrentEmail("");
}
}
Expand All @@ -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<void> => {
/* console.log(emailList); which is also to be removed */
if(isValid(currentEmail)) {
setEmails([...emailList, currentEmail]);
setCurrentEmail("");
}
const mailerArgs: MailerPollArgs = {
pollID: pollid,
pollTitle: polltitle,
Expand All @@ -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);
Expand Down Expand Up @@ -149,7 +153,7 @@ const Invitation = (props: {
onChange={handleChange}
onPaste={handlePaste}
/>
<Button className="my-2" variant="light" onClick={handleSubmit}>
<Button className="my-2" variant="light" onClick={handlePreSubmit}>
Invite
</Button>
</Form.Group>
Expand Down

1 comment on commit 87382d0

@vercel
Copy link

@vercel vercel bot commented on 87382d0 Jan 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.