fix: minor tidying

This commit is contained in:
Mythie
2023-08-30 14:01:30 +10:00
parent ed6fa4dc2a
commit d71e43c5d6
3 changed files with 9 additions and 6 deletions

View File

@ -76,7 +76,7 @@ export const PasswordForm = ({ className }: PasswordFormProps) => {
title: 'An unknown error occurred',
variant: 'destructive',
description:
'We encountered an unknown error while attempting to sign you In. Please try again later.',
'We encountered an unknown error while attempting to update your password. Please try again later.',
});
}
}

View File

@ -23,7 +23,7 @@ export const updatePassword = async ({ userId, password }: UpdatePasswordOptions
const isSamePassword = await compare(password, user.password as string);
if (isSamePassword) {
throw new Error('You cannot use the same password as your current password.');
throw new Error('Your new password cannot be the same as your old password.');
}
const updatedUser = await prisma.user.update({

View File

@ -40,13 +40,16 @@ export const profileRouter = router({
password,
});
} catch (err) {
const errorMessage = (err as { message?: string }).message;
let message =
'We were unable to update your profile. Please review the information you provided and try again.';
if (err instanceof Error) {
message = err.message;
}
throw new TRPCError({
code: 'BAD_REQUEST',
message: errorMessage
? errorMessage
: 'We were unable to update your profile. Please review the information you provided and try again.',
message,
});
}
}),