Added An Email Notification For When Startups Update Information#27
Added An Email Notification For When Startups Update Information#27NihalSaxena wants to merge 1 commit into
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/founders-uiuc/startup-directory/BtUBnqs48kZKzG7YrUMDWgEtorXJ |
daviskeene
left a comment
There was a problem hiding this comment.
A few comments for code optimizations, but otherwise looking great!
| .then((res) => res.json()) | ||
| .then((json) => { | ||
| json.data && setData(json.data); | ||
| console.log(json.data); |
There was a problem hiding this comment.
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.
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.| 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.
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.
| } | ||
| }; | ||
|
|
||
| //END HERE |
| var is_hiring = "HIRING: " + obj.isHiring; | ||
|
|
||
|
|
||
| console.log(name); |
There was a problem hiding this comment.
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.
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)