Skip to content

Commit

Permalink
add approved email
Browse files Browse the repository at this point in the history
  • Loading branch information
arthtyagi committed Dec 6, 2022
1 parent c0a3c6c commit 2285deb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/web/api/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const sgMail = require('@sendgrid/mail');
// this is documented somewhere in the github discussion of vercel;
// when using vite with vercel serverless, use the require syntax

type EmailType = 'welcome' | 'reminder';
type EmailType = 'welcome' | 'reminder' | 'approved' | 'rejected';

const sendEmail = async (
req: VercelRequest,
Expand All @@ -29,6 +29,8 @@ const sendEmail = async (
case 'reminder':
templateId = process.env.SENDGRID_REMINDER_TID;
break;
case 'approved':
templateId = process.env.SENDGRID_APPROVED_TID;
default:
templateId = process.env.SENDGRID_WELCOME_TID;
}
Expand Down Expand Up @@ -123,6 +125,10 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
sendEmail(req, devMode, res, 'reminder');
break;
}
case req.url?.startsWith('/api/email/approved/'): {
sendEmail(req, devMode, res, 'approved');
break;
}
default: {
res.status(400).json({ message: 'Invalid request' });
break;
Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"SENDGRID_SCHEDULE_TID",
"SENDGRID_WELCOME_TID",
"SENDGRID_REMINDER_TID",
"SENDGRID_APPROVED_TID",
"VITE_GITHUB_CLIENT_ID",
"GITHUB_CLIENT_SECRET",
"VITE_API_URL",
Expand Down

2 comments on commit 2285deb

@vercel
Copy link

@vercel vercel bot commented on 2285deb Dec 6, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

devclad-landing – ./apps/landing

devclad-landing-git-main-devclad.vercel.app
devclad-landing.vercel.app
www.devclad.com
devclad.com
devclad-landing-devclad.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 2285deb Dec 6, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.