import { createTRPCClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '@zero/server/trpc';
import { getRuntimeBackendUrl } from '@/lib/runtime-urls';
import superjson from 'superjson';
const getUrl = () => getRuntimeBackendUrl() + '/api/trpc';
export const getServerTrpc = (req: Request) =>
createTRPCClient<AppRouter>({
links: [
httpBatchLink({
maxItems: 1,
url: getUrl(),
transformer: superjson,
headers: req.headers,
}),
],
});