mirror of
https://github.com/penxio/penx.git
synced 2026-01-15 00:18:08 -05:00
25 lines
638 B
TypeScript
25 lines
638 B
TypeScript
'use client'
|
|
|
|
// import type { AppRouter } from '@sponsor3/api'
|
|
import { AppRouter } from '@/server/_app'
|
|
import { createTRPCClient, httpBatchLink } from '@trpc/client'
|
|
import { createTRPCReact } from '@trpc/react-query'
|
|
import superjson from 'superjson'
|
|
|
|
export const api = createTRPCClient<AppRouter>({
|
|
links: [
|
|
httpBatchLink({
|
|
// url: `${process.env.NEXT_PUBLIC_BASE_URL}/api/trpc`,
|
|
url: `/api/trpc`,
|
|
transformer: superjson,
|
|
headers() {
|
|
return {
|
|
authorization: `Bearer ${(window as any).__TOKEN__}`,
|
|
}
|
|
},
|
|
}),
|
|
],
|
|
})
|
|
|
|
export const trpc = createTRPCReact<AppRouter>({})
|