chore: refactor sendMail to make it reusable

This commit is contained in:
Ephraim Atta-Duncan
2023-06-21 14:09:42 +00:00
parent 2798cd624d
commit 0456fe9826
5 changed files with 41 additions and 27 deletions

View File

@ -8,9 +8,13 @@ import { ZSendMailMutationSchema } from './schema';
export const mailRouter = router({
send: authenticatedProcedure.input(ZSendMailMutationSchema).mutation(async ({ input }) => {
try {
const { email } = input;
return await sendMail({ email });
return await sendMail({
template: input,
mail: {
from: '<hi@documenso>',
subject: 'Documeso Invite',
},
});
} catch (err) {
console.error(err);