Skip to content

Commit

Permalink
feat: trpc utils
Browse files Browse the repository at this point in the history
  • Loading branch information
rharkor committed Mar 20, 2024
1 parent 18cc76b commit bcd7d0c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/app/src/lib/trpc/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { AppRouter } from "@/api/_app"
import { env } from "@/lib/env"
import { logger } from "@next-boilerplate/lib/logger"
import { inferRouterOutputs } from "@trpc/server"

function getBaseUrl() {
if (typeof window !== "undefined") return ""
Expand All @@ -12,3 +14,9 @@ function getBaseUrl() {
export function getUrl() {
return getBaseUrl() + "/api/trpc"
}

/**
* This is a helper method to infer the output of a query resolver
* @example type HelloOutput = RouterOutputs['hello']
*/
export type RouterOutputs = inferRouterOutputs<AppRouter>;

0 comments on commit bcd7d0c

Please sign in to comment.