From e7690e7f930ac7f0d925d93a06dddf3724fd1ec0 Mon Sep 17 00:00:00 2001 From: Bernt Christian Egeland Date: Sat, 17 Aug 2024 15:09:37 +0200 Subject: [PATCH] orgid token --- src/server/api/routers/organizationRouter.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/server/api/routers/organizationRouter.ts b/src/server/api/routers/organizationRouter.ts index 2236d031..6f030da2 100644 --- a/src/server/api/routers/organizationRouter.ts +++ b/src/server/api/routers/organizationRouter.ts @@ -948,7 +948,11 @@ export const organizationRouter = createTRPCRouter({ await ctx.prisma.invitation.deleteMany({ where: { email: tokenPayload.email, - organizations: tokenPayload.organizationId, + organizations: { + some: { + organizationId: tokenPayload.organizationId, + }, + }, }, }); @@ -966,8 +970,8 @@ export const organizationRouter = createTRPCRouter({ organizationId: tokenPayload.organizationId, }; } - } catch (_e) { - throw new Error("An error occurred while processing the invitation link."); + } catch (error) { + throw new Error(error.message); } // if the user does not exist, return empty object return {};