Files
soline/src/lib/api.ts
T
2026-07-28 19:10:12 +05:30

18 lines
472 B
TypeScript

import {
createTRPCProxyClient,
httpBatchLink,
loggerLink,
} from '@trpc/client';
import { AppRouter } from "~/trpc/api/root";
import { getBaseUrl } from '~/utils/url';
// create the client, export it
export const api = createTRPCProxyClient<AppRouter>({
links: [
// will print out helpful logs when using client
// loggerLink(),
// identifies what url will handle trpc requests
httpBatchLink({ url: `${getBaseUrl()}/api/trpc` })
],
});