2
0

🚑 (billing) Fix checkout session email check

This commit is contained in:
Baptiste Arnaud
2024-06-27 19:20:37 +02:00
parent 7f82c2f998
commit be28d9d96a

View File

@ -78,7 +78,10 @@ export const createCheckoutSession = async ({
email, email,
}) })
if (existingCustomer && email !== existingCustomer.data[0].email) if (
existingCustomer.data.length > 0 &&
user.email !== existingCustomer.data.at(0)?.email
)
throw new TRPCError({ throw new TRPCError({
code: 'BAD_REQUEST', code: 'BAD_REQUEST',
message: 'Make sure to log in with the same email as the one provided', message: 'Make sure to log in with the same email as the one provided',