@creatorem/next-trpc 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/create-trpc-query-client.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,12 +124,14 @@ import "client-only";
|
|
|
124
124
|
|
|
125
125
|
import { envs } from "~/envs";
|
|
126
126
|
import { createTrpcQueryClient } from "@creatorem/next-trpc/query-client";
|
|
127
|
+
import { useQuery } from "@tanstack/react-query";
|
|
127
128
|
import { type AppRouter } from "./router";
|
|
128
129
|
|
|
129
130
|
const url = envs().NEXT_PUBLIC_YOUR_APP_URL + "/api/trpc";
|
|
130
131
|
|
|
131
132
|
export const clientTrpc = createTrpcQueryClient<AppRouter>({
|
|
132
133
|
url,
|
|
134
|
+
useQuery,
|
|
133
135
|
headers: async () => {
|
|
134
136
|
// add custom headers like Authorization to make it works with auth logic
|
|
135
137
|
return {
|
|
@@ -3,7 +3,7 @@ import { type EndpointClient, createTrpcClientOptions } from "./create-trpc-clie
|
|
|
3
3
|
import type { Router, Endpoint, router } from "./core";
|
|
4
4
|
type TrpcClientWithQuery<R extends Router<any>> = {
|
|
5
5
|
[K in keyof R]: R[K] extends Endpoint<infer Output, infer Input, any> ? EndpointClient<Input, Output> & {
|
|
6
|
-
useQuery: (queryOptions?: Omit<Parameters<typeof useQueryType>[0], "queryKey" | "queryFn">) => ReturnType<typeof useQueryType<Output
|
|
6
|
+
useQuery: (queryOptions?: Omit<Parameters<typeof useQueryType>[0], "queryKey" | "queryFn">) => ReturnType<typeof useQueryType<Awaited<Output>, Error, Awaited<Output>, string[]>>;
|
|
7
7
|
} : never;
|
|
8
8
|
};
|
|
9
9
|
export declare const createTrpcQueryClient: <R extends ReturnType<typeof router<any, Router<any>>>>(opts: createTrpcClientOptions & {
|