️ Short circuit subscription call for guests

This commit is contained in:
Luke Vella 2023-08-23 16:48:37 +01:00
parent 77dc11eaf7
commit 48f2fa90bd

View file

@ -20,6 +20,13 @@ export const user = router({
}); });
}), }),
subscription: possiblyPublicProcedure.query(async ({ ctx }) => { subscription: possiblyPublicProcedure.query(async ({ ctx }) => {
if (ctx.user.isGuest) {
// guest user can't have an active subscription
return {
active: false,
};
}
const user = await prisma.user.findUnique({ const user = await prisma.user.findUnique({
where: { where: {
id: ctx.user.id, id: ctx.user.id,