mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 23:15:36 +00:00
22 lines
484 B
TypeScript
22 lines
484 B
TypeScript
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<AppRouter>({
|
|
config({ ctx }) {
|
|
return {
|
|
links: [
|
|
httpBatchLink({
|
|
url: `${getBaseUrl()}/api/trpc`,
|
|
}),
|
|
],
|
|
};
|
|
},
|
|
ssr: false,
|
|
});
|