Closed angelhdzdev closed 1 year ago
I'm using namespaces, so my route is /trpc/auth.login where auth is the namespace for the authRouter, and has a login procedure.
Now I'm trying to read route params.
So my url is /trpc/auth.login/SomeID
And the procedure namespace:
const authRouter = router({ "login/:id": login })
Then in the context:
export function createContext (_event: H3Event) { return {params: _event.context.params} }
And I get:
I spent the whole day reading the tRPC docs, and asking the A.I. ( I don't write its name or I'll get SPAM).
Of course, in Nuxt 3, the route params are defined in the route files like server/api/some-route/[someParam].ts.
server/api/some-route/[someParam].ts
I also tried that syntax:
const authRouter = router({ "login/[id]": login })
I'm using namespaces, so my route is /trpc/auth.login where auth is the namespace for the authRouter, and has a login procedure.
Now I'm trying to read route params.
So my url is /trpc/auth.login/SomeID
And the procedure namespace:
Then in the context:
And I get:
I spent the whole day reading the tRPC docs, and asking the A.I. ( I don't write its name or I'll get SPAM).