mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: remove comments
This commit is contained in:
67
utils/api.ts
67
utils/api.ts
@@ -11,50 +11,39 @@ import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server";
|
|||||||
import superjson from "superjson";
|
import superjson from "superjson";
|
||||||
|
|
||||||
const getBaseUrl = () => {
|
const getBaseUrl = () => {
|
||||||
if (typeof window !== "undefined") return ""; // browser should use relative url
|
if (typeof window !== "undefined") return ""; // browser should use relative url
|
||||||
return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost
|
return `http://localhost:${process.env.PORT ?? 3000}`; // dev SSR should use localhost
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A set of type-safe react-query hooks for your tRPC API. */
|
/** A set of type-safe react-query hooks for your tRPC API. */
|
||||||
export const api = createTRPCNext<AppRouter>({
|
export const api = createTRPCNext<AppRouter>({
|
||||||
config() {
|
config() {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Transformer used for data de-serialization from the server.
|
* Transformer used for data de-serialization from the server.
|
||||||
*
|
*
|
||||||
* @see https://trpc.io/docs/data-transformers
|
* @see https://trpc.io/docs/data-transformers
|
||||||
*/
|
*/
|
||||||
transformer: superjson,
|
transformer: superjson,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Links used to determine request flow from client to server.
|
* Links used to determine request flow from client to server.
|
||||||
*
|
*
|
||||||
* @see https://trpc.io/docs/links
|
* @see https://trpc.io/docs/links
|
||||||
*/
|
*/
|
||||||
links: [
|
links: [
|
||||||
httpBatchLink({
|
httpBatchLink({
|
||||||
url: `${getBaseUrl()}/api/trpc`,
|
url: `${getBaseUrl()}/api/trpc`,
|
||||||
}),
|
}),
|
||||||
// createWSClient({
|
],
|
||||||
// url: `ws://localhost:3000`,
|
};
|
||||||
// }),
|
},
|
||||||
// loggerLink({
|
/**
|
||||||
// enabled: (opts) =>
|
* Whether tRPC should await queries when server rendering pages.
|
||||||
// process.env.NODE_ENV === "development" ||
|
*
|
||||||
// (opts.direction === "down" && opts.result instanceof Error),
|
* @see https://trpc.io/docs/nextjs#ssr-boolean-default-false
|
||||||
// }),
|
*/
|
||||||
// httpBatchLink({
|
ssr: false,
|
||||||
// url: `${getBaseUrl()}/api/trpc`,
|
|
||||||
// }),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Whether tRPC should await queries when server rendering pages.
|
|
||||||
*
|
|
||||||
* @see https://trpc.io/docs/nextjs#ssr-boolean-default-false
|
|
||||||
*/
|
|
||||||
ssr: false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user