Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

Remove email route (#389)

Sean Boultded53a3e6686
diff --git a/apps/email/emails/waitlist-user-signup.tsx b/apps/email/emails/waitlist-user-signup.tsx
index 69bf8c95..ff38e6e1 100644
--- a/apps/email/emails/waitlist-user-signup.tsx
+++ b/apps/email/emails/waitlist-user-signup.tsx
@@ -35,10 +35,10 @@ export const UserSignupEmail = () => {
</Heading>
<Text className="pb-2 text-[20px] leading-[24px] text-black">Hey there πŸ‘‹</Text>
<Text className="text-[14px] leading-[24px] text-black">
- Thank you so much for signing up for the typehero waitlist, we really apperciate it.
+ Thank you so much for signing up for the typehero waitlist, we really appreciate it.
</Text>
<Text className="text-[14px] leading-[24px] text-black">
- We are cooking extremelly hard to bring you the best experience for doing type
+ We are cooking extremely hard to bring you the best experience for doing type
challenges.
</Text>
<Container className="w-fit mx-auto pt-4">
diff --git a/apps/web/src/app/api/email/route.ts b/apps/web/src/app/api/email/route.ts
deleted file mode 100644
index 176e086d..00000000
--- a/apps/web/src/app/api/email/route.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-// TODO: fix the import paths
-import { UserSignupEmail } from '@repo/emails/emails/index';
-import type { NextRequest } from 'next/server';
-import { NextResponse } from 'next/server';
-import { Resend } from 'resend';
-
-// TODO: this is awaiting trash to setup on vercel
-const resend = new Resend(process.env.RESEND_API_KEY);
-
-// TODO: THIS HAS TO BE REMOVED
-export async function GET(request: NextRequest) {
- const { searchParams } = new URL(request.url);
- // TODO: remove this default email
- const to = searchParams.get('to') ?? '[email protected]';
-
- try {
- return NextResponse.json(sendUserSignupEmail(to));
- } catch (error) {
- return NextResponse.json({ error });
- }
-}
-
-/**
- * send a signup email that will use resend to send an email
- * using the template from the app/email package
- */
-export const sendUserSignupEmail = async (to: string) => {
- const data = await resend.emails.send({
- from: 'Typehero <[email protected]>',
- to: [to],
- subject: 'πŸ”₯ Thanks for signing up to Typehero!',
- react: UserSignupEmail(),
- });
-
- return {
- emailId: data.id,
- to,
- };
-};
diff --git a/apps/web/src/components/landing/waitlist/create.action.ts b/apps/web/src/components/landing/waitlist/create.action.ts
index b1671f23..949d863c 100644
--- a/apps/web/src/components/landing/waitlist/create.action.ts
+++ b/apps/web/src/components/landing/waitlist/create.action.ts
@@ -1,9 +1,30 @@
'use server';
import { prisma } from '@repo/db';
-import { sendUserSignupEmail } from '~/app/api/email/route';
+import { Resend } from 'resend';
+import { UserSignupEmail } from '@repo/emails/emails/index';
import { type WaitlistFormSchema } from '~/components/landing/waitlist/waitlist-form';
+const resend = new Resend(process.env.RESEND_API_KEY);
+
+/**
+ * send a signup email that will use resend to send an email
+ * using the template from the app/email package
+ */
+export const sendUserSignupEmail = async (to: string) => {
+ const data = await resend.emails.send({
+ from: 'Typehero <[email protected]>',
+ to: [to],
+ subject: 'πŸ”₯ Thanks for signing up to Typehero!',
+ react: UserSignupEmail(),
+ });
+
+ return {
+ emailId: data.id,
+ to,
+ };
+};
+
export async function uploadWaitlistEntry(data: WaitlistFormSchema) {
const isUser = data.intention === 'user';
const isBuilder = data.intention === 'builder';