mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-20 20:36:19 +02:00
⚡️ Short circuit subscription call for guests
This commit is contained in:
parent
77dc11eaf7
commit
48f2fa90bd
1 changed files with 7 additions and 0 deletions
|
@ -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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue