import { httpBatchLink } from "@trpc/client"; import { createTRPCNext } from "@trpc/next"; import type { AppRouter } from "../server/routers/_app"; const getBaseUrl = () => typeof window !== "undefined" ? "" : `http://localhost:${process.env.PORT ?? 3000}`; export const trpc = createTRPCNext({ config({ ctx }) { return { links: [ httpBatchLink({ url: `${getBaseUrl()}/api/trpc`, }), ], }; }, ssr: false, });