test trpc

This commit is contained in:
2023-05-02 19:42:40 +02:00
parent a598c1fe94
commit c05d1a9e6e
3 changed files with 24 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import { loggerLink } from '@trpc/client'
import SuperJSON from 'superjson'
import { createTRPCNuxtClient, httpBatchLink } from 'trpc-nuxt/client'
import type { AppRouter } from '~/server/trpc/routers'
@@ -6,6 +7,11 @@ export default defineNuxtPlugin(() => {
const trpc = createTRPCNuxtClient<AppRouter>({
transformer: SuperJSON,
links: [
loggerLink({
enabled: opts =>
process.env.NODE_ENV === 'development'
|| (opts.direction === 'down' && opts.result instanceof Error),
}),
httpBatchLink({
url: '/api/trpc',
}),