mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
update orpc tanstack query integration (#299)
This commit is contained in:
@@ -3,7 +3,7 @@ import type { RouterClient } from '@orpc/server'
|
||||
import type { appRouter } from "../../../server/src/routers/index";
|
||||
import { createORPCClient } from '@orpc/client'
|
||||
import { RPCLink } from '@orpc/client/fetch'
|
||||
import { createORPCVueQueryUtils } from '@orpc/vue-query'
|
||||
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
||||
|
||||
export default defineNuxtPlugin(() => {
|
||||
const config = useRuntimeConfig()
|
||||
@@ -25,7 +25,7 @@ export default defineNuxtPlugin(() => {
|
||||
|
||||
|
||||
const client: RouterClient<typeof appRouter> = createORPCClient(rpcLink)
|
||||
const orpcUtils = createORPCVueQueryUtils(client)
|
||||
const orpcUtils = createTanstackQueryUtils(client)
|
||||
|
||||
return {
|
||||
provide: {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { createORPCClient } from "@orpc/client";
|
||||
import { RPCLink } from "@orpc/client/fetch";
|
||||
import { createORPCReactQueryUtils } from "@orpc/react-query";
|
||||
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
||||
import { QueryCache, QueryClient } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import type { appRouter } from "../../../server/src/routers/index";
|
||||
import type { RouterClient } from "@orpc/server";
|
||||
import { createContext, use } from 'react'
|
||||
import type { RouterUtils } from '@orpc/react-query'
|
||||
import type { RouterUtils } from '@orpc/tanstack-query'
|
||||
|
||||
type ORPCReactUtils = RouterUtils<RouterClient<typeof appRouter>>
|
||||
|
||||
@@ -43,7 +43,7 @@ export const link = new RPCLink({
|
||||
|
||||
export const client: RouterClient<typeof appRouter> = createORPCClient(link)
|
||||
|
||||
export const orpc = createORPCReactQueryUtils(client)
|
||||
export const orpc = createTanstackQueryUtils(client)
|
||||
|
||||
|
||||
export const ORPCContext = createContext<ORPCReactUtils | undefined>(undefined)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createORPCClient } from "@orpc/client";
|
||||
import { RPCLink } from "@orpc/client/fetch";
|
||||
import { createORPCSolidQueryUtils } from "@orpc/solid-query";
|
||||
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
||||
import { QueryCache, QueryClient } from "@tanstack/solid-query";
|
||||
import type { appRouter } from "../../../server/src/routers/index";
|
||||
import type { RouterClient } from "@orpc/server";
|
||||
@@ -27,4 +27,4 @@ export const link = new RPCLink({
|
||||
|
||||
export const client: RouterClient<typeof appRouter> = createORPCClient(link);
|
||||
|
||||
export const orpc = createORPCSolidQueryUtils(client);
|
||||
export const orpc = createTanstackQueryUtils(client);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { PUBLIC_SERVER_URL } from "$env/static/public";
|
||||
import { createORPCClient } from "@orpc/client";
|
||||
import { RPCLink } from "@orpc/client/fetch";
|
||||
import type { RouterClient } from "@orpc/server";
|
||||
import { createORPCSvelteQueryUtils } from "@orpc/svelte-query";
|
||||
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
||||
import { QueryCache, QueryClient } from "@tanstack/svelte-query";
|
||||
import type { appRouter } from "../../../server/src/routers/index";
|
||||
|
||||
@@ -28,4 +28,4 @@ export const link = new RPCLink({
|
||||
|
||||
export const client: RouterClient<typeof appRouter> = createORPCClient(link);
|
||||
|
||||
export const orpc = createORPCSvelteQueryUtils(client);
|
||||
export const orpc = createTanstackQueryUtils(client);
|
||||
|
||||
Reference in New Issue
Block a user