const sentryMiddleware = t.middleware(
Sentry.Handlers.trpcMiddleware({
attachRpcInput: true,
})
);
const enforceUserIsAuthorized = t.middleware(async ({ ctx, next }) => {
if (!ctx.currentUser)
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You need to be authorized to do this.",
});
return next({ ctx: { currentUser: ctx.currentUser } });
});
export const privateProcedure = t.procedure
.use(sentryMiddleware)
.use(enforceUserIsAuthorized);
const sentryMiddleware = t.middleware(
Sentry.Handlers.trpcMiddleware({
attachRpcInput: true,
})
);
const enforceUserIsAuthorized = t.middleware(async ({ ctx, next }) => {
if (!ctx.currentUser)
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You need to be authorized to do this.",
});
return next({ ctx: { currentUser: ctx.currentUser } });
});
export const privateProcedure = t.procedure
.use(sentryMiddleware)
.use(enforceUserIsAuthorized);