(ctx: TRPCContext)
| 12 | }; |
| 13 | |
| 14 | const requireUserId = (ctx: TRPCContext) => { |
| 15 | if (!ctx.session?.user.id) { |
| 16 | throw new TRPCError({ |
| 17 | code: "UNAUTHORIZED", |
| 18 | message: "This function is only available to signed-in users.", |
| 19 | }); |
| 20 | } |
| 21 | return ctx.session.user.id; |
| 22 | }; |
| 23 | |
| 24 | // No-op method for protected routes that really should be accessible to anyone. |
| 25 | export const requireNothing = (ctx: TRPCContext) => { |
no outgoing calls
no test coverage detected