-
Notifications
You must be signed in to change notification settings - Fork 0
Added An Email Notification For When Startups Update Information #27
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ import styles from '../../styles/Account.module.css'; | |
| import AccountContext from '../../utils/AccountContext'; | ||
| import OrgSelection from './OrgSelection'; | ||
| import Form from '../../components/Form'; | ||
| import emailjs from 'emailjs-com'; | ||
|
|
||
| const STAGES = Object.freeze({ | ||
| DEFAULT: 'DEFAULT', | ||
|
|
@@ -15,7 +16,13 @@ export default function Onboarding({ user }) { | |
| const [selectedToJoin, setSelectedToJoin] = React.useState(undefined); | ||
|
|
||
| const { account, setAccount } = React.useContext(AccountContext); | ||
|
|
||
|
|
||
| const formatMessage = (data) => { | ||
| // Edit this method to make a new string that is more readable containing changes made to the data. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: Edit this method to make a new string that is more readable containing changes made to the data. |
||
| return JSON.parse(JSON.stringify(data)); | ||
| } | ||
|
|
||
| //START HERE | ||
| const handleSubmitOrg = async (submission) => { | ||
| const { formData } = submission; | ||
|
|
||
|
|
@@ -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'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Email.js keys should be put into |
||
| } else { | ||
| console.error('Post Failed'); | ||
| } | ||
| }; | ||
|
|
||
| //END HERE | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete |
||
| let content = ( | ||
| <div className={styles.actionGrid}> | ||
| <div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,9 @@ import { withPageAuthRequired } from '@auth0/nextjs-auth0'; | |
| import Onboarding from '../../components/accounts/Onboarding'; | ||
| import Layout from '../../components/Layout'; | ||
|
|
||
| import emailjs from 'emailjs-com'; | ||
|
|
||
|
|
||
| function Account() { | ||
| const [isLoading, setIsLoading] = React.useState(true); | ||
| const { user } = useUser(); | ||
|
|
@@ -25,13 +28,43 @@ function Account() { | |
| return null; | ||
| } | ||
|
|
||
| const formatMessage = (data) => { | ||
| // Edit this method to make a new string that is more readable containing changes made to the data. | ||
| return JSON.parse(JSON.stringify(data)); | ||
| } | ||
|
|
||
| const handleFormSubmit = async (submission) => { | ||
| const { formData: data } = submission; | ||
| const res = await fetch('/api/accounts/org', { | ||
| method: 'PATCH', | ||
| body: JSON.stringify({ ...data, email: account.email }), | ||
| }); | ||
| const json = await res.json(); | ||
| //Notify founders of change | ||
| var obj = formatMessage(data); | ||
| var name = "NAME: " + obj.name; | ||
| var description = "DESCRIPTION: " + obj.description; | ||
| var founded_date = "FOUNDED DATE: " + obj.founded; | ||
| var category = "CATEGORY: " + obj.categories; | ||
| var stage = "STAGE: " + obj.stage; | ||
| var size = "SIZE: " + obj.size; | ||
| var biography = "BIOGRAPHY: " + obj.biography; | ||
| var is_hiring = "HIRING: " + obj.isHiring; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 emailjs.send('service_2cqk6gm', 'template_6z1qve1', obj, 'user_4ilUAq4zJ8J7iYZTlGs2l');And then change the corresponding template in emailjs |
||
|
|
||
|
|
||
| console.log(name); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, delete console.log statements |
||
| console.log(description); | ||
| console.log(founded_date); | ||
| console.log(category); | ||
| console.log(stage); | ||
| console.log(size); | ||
| console.log(biography); | ||
| console.log(is_hiring); | ||
| emailjs.send('service_2cqk6gm', 'template_6z1qve1', {'name': name, 'description': description, 'founded_date': founded_date, 'category': category, 'stage': stage, 'size': size, 'biography': biography, 'is_hiring': is_hiring}, 'user_4ilUAq4zJ8J7iYZTlGs2l'); | ||
| console.log(json); | ||
| // sendEmail({ | ||
| // text: data, | ||
| // }); | ||
| setIsLoading(false); | ||
| }; | ||
|
|
||
|
|
||
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