mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-14 12:14:40 +01:00
add superjson to playground
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"superjson": "^1.11.0",
|
||||
"trpc-nuxt": "workspace:*",
|
||||
"zod": "^3.19.1"
|
||||
},
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user