import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '@/server/trpc/trpc';

export const createTRPCClient = (opts: {
  baseURL: string;
}) => {
  return createTRPCProxyClient<AppRouter>(
    {
      links: [
        httpBatchLink({
          url: opts.baseURL,
        }),
      ],
    },
    {
      transformer: opts.transformer,
    }
  );
};

export default createTRPCClient;
