mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-14 12:14:40 +01:00
20 lines
418 B
TypeScript
20 lines
418 B
TypeScript
import { httpBatchLink } from '@trpc/client'
|
|
import { createTRPCNuxtProxyClient } from 'trpc-nuxt/client'
|
|
import type { AppRouter } from '~~/server/trpc/routers'
|
|
|
|
export default defineNuxtPlugin(() => {
|
|
const client = createTRPCNuxtProxyClient<AppRouter>({
|
|
links: [
|
|
httpBatchLink({
|
|
url: 'http://localhost:3000/api/trpc',
|
|
}),
|
|
],
|
|
})
|
|
|
|
return {
|
|
provide: {
|
|
client,
|
|
},
|
|
}
|
|
})
|