Example: Added a basic example with a product call

This commit is contained in:
Ryan Gannon
2023-06-13 15:00:38 +01:00
parent ad85a78350
commit 3fc261d5e7
15 changed files with 343 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { createTRPCNuxtClient, httpBatchLink } from 'trpc-nuxt/client'
import type { AppRouter } from '~/server/trpc/routers'
export default defineNuxtPlugin(() => {
/**
* createTRPCNuxtClient adds a `useQuery` composable
* built on top of `useAsyncData`.
*/
const client = createTRPCNuxtClient<AppRouter>({
links: [
httpBatchLink({
url: '/api/trpc',
}),
],
})
return {
provide: {
client,
},
}
})