add solid

This commit is contained in:
Aman Varshney
2025-05-05 09:51:33 +05:30
parent e9f63be765
commit 4f89b8bc15
41 changed files with 1362 additions and 207 deletions

View File

@@ -0,0 +1,30 @@
import { createORPCClient } from "@orpc/client";
import { RPCLink } from "@orpc/client/fetch";
import { createORPCSolidQueryUtils } from "@orpc/solid-query";
import { QueryCache, QueryClient } from "@tanstack/solid-query";
import type { appRouter } from "../../../server/src/routers/index";
import type { RouterClient } from "@orpc/server";
export const queryClient = new QueryClient({
queryCache: new QueryCache({
onError: (error) => {
console.error(`Error: ${error.message}`);
},
}),
});
export const link = new RPCLink({
url: `${import.meta.env.VITE_SERVER_URL}/rpc`,
{{#if auth}}
fetch(url, options) {
return fetch(url, {
...options,
credentials: "include",
});
},
{{/if}}
});
export const client: RouterClient<typeof appRouter> = createORPCClient(link);
export const orpc = createORPCSolidQueryUtils(client);