tRPCttRPC
Powered by
santiS
tRPC•3y ago•
1 reply
santi

How can I access ctx from inside of a procedure?

const appRouter = t.router({
  helloTab: t.procedure.input(z.object({ url: z.string().url() })).mutation(async ({ input, ctx }) => {
    //@ts-ignore
    const tab = ctx.sender.tab
    console.log(tab)
  }),
});
const appRouter = t.router({
  helloTab: t.procedure.input(z.object({ url: z.string().url() })).mutation(async ({ input, ctx }) => {
    //@ts-ignore
    const tab = ctx.sender.tab
    console.log(tab)
  }),
});

is something like this possible? Not working for me
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Infer the type of ctx for a specific procedure
iDarkLightningIiDarkLightning / ❓-help
4y ago
How can I cache a single procedure?
Mark LMMark L / ❓-help
4y ago
how can i get procedure name?
CaptainCCaptain / ❓-help
4y ago