Skip to content
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

Added An Email Notification For When Startups Update Information #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NihalSaxena
Copy link

@NihalSaxena NihalSaxena commented Oct 21, 2021

Title

Email Notification for Startup Updates

Changes

  • Created new function named formatMessage() to index.js and Onboarding.js that converts user-input from the directory form into a string.
  • Modified handleFormSubmit() (in index.js) to send email notification whenever a startup updates their existing information.
  • Modified handleSubmitOrg() (in Onboarding.js) to send an email notification whenever a new startup is added to the directory.

Screenshots (if applicable)

@vercel
Copy link

vercel bot commented Oct 21, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/founders-uiuc/startup-directory/BtUBnqs48kZKzG7YrUMDWgEtorXJ
✅ Preview: https://startup-directory-git-email-notification-f-0ac48f-founders-uiuc.vercel.app

Copy link
Contributor

@daviskeene daviskeene left a comment

Choose a reason for hiding this comment

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

A few comments for code optimizations, but otherwise looking great!

@@ -41,6 +41,7 @@ export default function Feed({ filters }) {
.then((res) => res.json())
.then((json) => {
json.data && setData(json.data);
console.log(json.data);
Copy link
Contributor

Choose a reason for hiding this comment

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

Get rid of console.log() statements for prod



const formatMessage = (data) => {
// Edit this method to make a new string that is more readable containing changes made to the data.
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future, notes about things that should get done soon should start with TODO:

// TODO: Edit this method to make a new string that is more readable containing changes made to the data.

@@ -32,11 +39,12 @@ export default function Onboarding({ user }) {
const json = await res.json();
if (json?.data?.id) {
setAccount({ ...account, orgId: json.data.id });
emailjs.send('service_2cqk6gm', 'template_6z1qve1', {'message': formatMessage(data)}, 'user_4ilUAq4zJ8J7iYZTlGs2l');
Copy link
Contributor

Choose a reason for hiding this comment

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

Email.js keys should be put into .env.local for now. We can load them in as environment variables in the vercel deploy to keep them hidden from the public.

} else {
console.error('Post Failed');
}
};

//END HERE
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete

var is_hiring = "HIRING: " + obj.isHiring;


console.log(name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, delete console.log statements

var stage = "STAGE: " + obj.stage;
var size = "SIZE: " + obj.size;
var biography = "BIOGRAPHY: " + obj.biography;
var is_hiring = "HIRING: " + obj.isHiring;
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of declaring a new variable for each of these, let's consider using a more programmatic approach. Realistically, we can simply pass obj into the emailjs.send() method:

emailjs.send('service_2cqk6gm', 'template_6z1qve1', obj, 'user_4ilUAq4zJ8J7iYZTlGs2l');

And then change the corresponding template in emailjs

A startup has updated it's info! Here is the updated version:

NAME: {{name}}
DESCRIPTION: {{description}}
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants