Update: Implement delete account feature + package updates

This commit is contained in:
Aaron William Po
2023-06-01 19:56:14 -04:00
parent 6fcd7b53d0
commit b644e7eeee
9 changed files with 518 additions and 492 deletions

View File

@@ -5,6 +5,7 @@ import Welcome from '@/emails/Welcome';
import { render } from '@react-email/render';
import { z } from 'zod';
import { BASE_URL } from '@/config/env';
import { ReactElement } from 'react';
import GetUserSchema from './schema/GetUserSchema';
type UserSchema = z.infer<typeof GetUserSchema>;
@@ -17,8 +18,10 @@ const sendConfirmationEmail = async ({ id, username, email }: UserSchema) => {
const url = `${BASE_URL}/users/confirm?token=${confirmationToken}`;
const address = email;
const html = render(Welcome({ name, url, subject })!);
const text = render(Welcome({ name, url, subject })!, { plainText: true });
const component = Welcome({ name, url, subject })! as ReactElement<unknown, string>;
const html = render(component);
const text = render(component, { plainText: true });
await sendEmail({ address, subject, text, html });
};