Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

trpc-client.ts

15 lines382 Bytes

1import { createTRPCProxyClient, httpBatchLink } from "@trpc/client"
2import type { AppRouter } from "@/routes/api/trpc/$"
3​
4export const trpc = createTRPCProxyClient<AppRouter>({
5 links: [
6 httpBatchLink({
7 url: "/api/trpc",
8 async headers() {
9 return {
10 cookie: typeof document !== "undefined" ? document.cookie : "",
11 }
12 },
13 }),
14 ],
15})