chore: refactor

This commit is contained in:
Catalin Pit
2024-01-26 13:27:36 +02:00
parent e2fa01509d
commit b2cca9afb6
6 changed files with 13 additions and 10 deletions

View File

@ -135,11 +135,15 @@ export const profileRouter = router({
.input(ZConfirmEmailMutationSchema)
.mutation(async ({ input }) => {
try {
const { email } = input;
const { encryptedEmail } = input;
const decryptedEmail = decryptSecondaryData(email);
const decryptedEmail = decryptSecondaryData(encryptedEmail);
return await sendConfirmationToken({ email: decryptedEmail ?? '' }); // TODO: fix this tomorrow
if (!decryptedEmail) {
throw new Error('Email is required');
}
return await sendConfirmationToken({ email: decryptedEmail });
} catch (err) {
let message = 'We were unable to send a confirmation email. Please try again.';

View File

@ -30,9 +30,9 @@ export const ZResetPasswordFormSchema = z.object({
password: z.string().min(6),
token: z.string().min(1),
});
// TODO: revisit this
export const ZConfirmEmailMutationSchema = z.object({
email: z.string().min(1),
encryptedEmail: z.string().min(1),
});
export type TRetrieveUserByIdQuerySchema = z.infer<typeof ZRetrieveUserByIdQuerySchema>;