Openstatus www.openstatus.dev
at faccb97887890dd3a67ee3910959f4abcd169d2a 22 lines 551 B view raw
1import { createTRPCClient, loggerLink } from "@trpc/client"; 2 3import type { AppRouter } from "@openstatus/api"; 4 5import { endingLink } from "./shared"; 6 7export const api = createTRPCClient<AppRouter>({ 8 links: [ 9 loggerLink({ 10 enabled: (opts) => 11 process.env.NODE_ENV === "development" || 12 (opts.direction === "down" && opts.result instanceof Error), 13 }), 14 endingLink({ 15 headers: { 16 "x-trpc-source": "client", 17 }, 18 }), 19 ], 20}); 21 22export { type RouterInputs, type RouterOutputs } from "@openstatus/api";