update docs

This commit is contained in:
wobsoriano
2022-11-24 12:51:28 -08:00
parent b27938f108
commit 68003e9c3e
4 changed files with 52 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ import superjson from 'superjson'
import type { AppRouter } from '~~/server/trpc/routers'
export default defineNuxtPlugin(() => {
const headers = useRequestHeaders()
const client = createTRPCProxyClient<AppRouter>({
transformer: superjson,
links: [
@@ -13,7 +14,12 @@ export default defineNuxtPlugin(() => {
(opts.direction === 'down' && opts.result instanceof Error)
}),
httpBatchLink({
url: 'http://localhost:3000/api/trpc'
url: 'http://localhost:3000/api/trpc',
headers () {
return {
...unref(headers)
}
}
})
]
})