add superjson to playground

This commit is contained in:
Robert Soriano
2022-10-29 22:33:59 -07:00
parent b61dbd1786
commit 97dfefe6cd
4 changed files with 29 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"superjson": "^1.11.0",
"trpc-nuxt": "workspace:*",
"zod": "^3.19.1"
},

View File

@@ -1,9 +1,12 @@
import { httpBatchLink, loggerLink } from '@trpc/client'
import { createTRPCNuxtProxyClient } from 'trpc-nuxt/client'
import superjson from 'superjson'
import type { AppRouter } from '~~/server/trpc/routers'
export default defineNuxtPlugin(() => {
const client = createTRPCNuxtProxyClient<AppRouter>({
transformer: superjson,
links: [
// adds pretty logs to your console in development and logs errors in production
loggerLink({

View File

@@ -1,7 +1,10 @@
import { initTRPC } from '@trpc/server'
import superjson from 'superjson'
import type { Context } from './context'
const t = initTRPC.context<Context>().create()
const t = initTRPC.context<Context>().create({
transformer: superjson
})
/**
* Create a router