update playground

This commit is contained in:
Robert Soriano
2022-10-29 22:29:21 -07:00
parent 4bb2cdc2d2
commit b61dbd1786
3 changed files with 8 additions and 4 deletions

View File

@@ -1,10 +1,16 @@
import { httpBatchLink } from '@trpc/client'
import { httpBatchLink, loggerLink } from '@trpc/client'
import { createTRPCNuxtProxyClient } from 'trpc-nuxt/client'
import type { AppRouter } from '~~/server/trpc/routers'
export default defineNuxtPlugin(() => {
const client = createTRPCNuxtProxyClient<AppRouter>({
links: [
// adds pretty logs to your console in development and logs errors in production
loggerLink({
enabled: opts =>
process.env.NODE_ENV === 'development'
|| (opts.direction === 'down' && opts.result instanceof Error),
}),
httpBatchLink({
url: 'http://localhost:3000/api/trpc',
}),