Revert "♻️ Improve email abstraction (#861)"

This reverts commit 93cc5b9b4d.
This commit is contained in:
Luke Vella 2023-09-15 15:32:37 +01:00
parent 93cc5b9b4d
commit 1199ca5c53
10 changed files with 141 additions and 738 deletions

View file

@ -1,10 +1,10 @@
import { prisma } from "@rallly/database";
import { sendEmail } from "@rallly/emails";
import { absoluteUrl } from "@rallly/utils";
import { TRPCError } from "@trpc/server";
import { z } from "zod";
import { createToken, decryptToken } from "../../session";
import { emailClient } from "../../utils/email-client";
import { generateOtp } from "../../utils/nanoid";
import { publicProcedure, router } from "../trpc";
import { LoginTokenPayload, RegistrationTokenPayload } from "../types";
@ -107,7 +107,7 @@ export const auth = router({
code,
});
await emailClient.sendTemplate("RegisterEmail", {
await sendEmail("RegisterEmail", {
to: input.email,
subject: `${input.name}, please verify your email address`,
props: {
@ -193,7 +193,7 @@ export const auth = router({
code,
});
await emailClient.sendTemplate("LoginEmail", {
await sendEmail("LoginEmail", {
to: input.email,
subject: `${code} is your 6-digit code`,
props: {