-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/founders-uiuc/startup-directory/BtUBnqs48kZKzG7YrUMDWgEtorXJ |
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.
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); |
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.
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. |
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.
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'); |
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.
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 |
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.
Delete
var is_hiring = "HIRING: " + obj.isHiring; | ||
|
||
|
||
console.log(name); |
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.
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; |
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.
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}}
...
Title
Email Notification for Startup Updates
Changes
Screenshots (if applicable)