15 lines
366 B
TypeScript
15 lines
366 B
TypeScript
import { createTRPCReact } from '@trpc/react-query'
|
|
import { httpBatchLink } from '@trpc/client'
|
|
import type { AppRouter } from '@repo/shared'
|
|
|
|
export const trpc = createTRPCReact<AppRouter>()
|
|
|
|
export function createTrpcClient(baseUrl: string) {
|
|
return trpc.createClient({
|
|
links: [
|
|
httpBatchLink({
|
|
url: `${baseUrl}/trpc`,
|
|
}),
|
|
],
|
|
})
|
|
}
|