()
| 11 | import { type AppRouter } from "~/server/api/root.router"; |
| 12 | |
| 13 | const getBaseUrl = () => { |
| 14 | if (typeof window !== "undefined") return ""; // browser should use relative url |
| 15 | if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; // SSR should use vercel url |
| 16 | return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost |
| 17 | }; |
| 18 | |
| 19 | /** A set of type-safe react-query hooks for your tRPC API. */ |
| 20 | export const api = createTRPCNext<AppRouter>({ |