-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update contact page to form that sends email upon submission #203
Update contact page to form that sends email upon submission #203
Conversation
@misterbastean is attempting to deploy a commit to the Teacherfund Team on Vercel. A member of the Team first needs to authorize it. |
This is awesome! Thanks @misterbastean we'll review sometime this week :) |
Sure thing, happy to help.
Let me know if any changes are needed.
Best,
…On Tue, Jun 1, 2021 at 12:48 PM Joel Wasserman ***@***.***> wrote:
This is awesome! Thanks @misterbastean <https://github.com/misterbastean>
we'll review sometime this week :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#203 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFZMMQQUEUOOUIC55YDLDDTTQUFMNANCNFSM45XLMIQQ>
.
--
Joshua Bastean, Ed.D.
IT Analyst and Designer
Apple Learning Specialist
Apple Teacher
|
components/about/contactForm.js
Outdated
if (res.status === 200) { | ||
setName('') | ||
setEmail('') | ||
setSubject('') | ||
setMessage('') | ||
} else { | ||
} | ||
}).catch((err) => { | ||
// TODO: Add error handling | ||
console.log('ERROR:', err) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps if sending the message fails it should notify the user in some way so they aren't expecting that it worked behind the scenes. Can the UI be updated with some kind of failure message/toast ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Added Chakra Toast to notify user email was sent or if there is an error. Still needs better error handling, because it's just a catchall right now, but it works fine for now.
@joelwass Updated PR. I'm new to contributing to OS on Github, so not sure I submitted correctly or if you get notified automatically, etc. |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/teacherfund/teacherfund/AY7EG6RkKPMTi2gZMkZD9EgLK4v5 |
Yea the reviewers get emails when pushes are pushed :) thanks for the changes! looks good, i'm going to let it deploy to our preview branch so i can test it in the UI |
}) | ||
} | ||
}).catch((err) => { | ||
// TODO: Add better error handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove these console logs? also - you set the description of the toast to err, should it be err.message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason our CI breaks on this PR, i'm digging into why then will merge after consoles removed :)
pages/api/contact.js
Outdated
console.log('Error sending email:', err) | ||
res.status(500).json({ success: false, err }) | ||
} else { | ||
console.log(info) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove consoles :)
Consoles removed, fixed typo (err => err.message). Thanks for catching those! |
Thank you! I'm going to wait to merge until i figure out our CI issue but i'll merge when we get that figured out, thanks again! |
Currently set to send emails to Mailtrap for testing, so need to update SMTP settings in /pages/api/contact.js as needed.
Also added 2 environmental variables: EMAIL_USERNAME and EMAIL_PASSWORD, again for SMTP.