freshyo/apps/web-ui/.output/server/_ssr/trpc-client-CQOIB5UU.mjs
2026-05-10 16:45:39 +05:30

21 lines
785 B
JavaScript

import { a as httpBatchLink, n as createTRPCClient } from "../_libs/trpc__client+trpc__server.mjs";
import { t as createTRPCReact } from "../_libs/trpc__react-query.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/trpc-client-CQOIB5UU.js
var BASE_API_URL = "http://192.168.100.111:8787";
var trpc = createTRPCReact();
function getTrpcClient() {
return createTRPCClient({ links: [httpBatchLink({
url: `${BASE_API_URL}/api/trpc`,
headers: async () => {
try {
const token = localStorage.getItem("auth_token");
const headers = { "caller-interface": "web" };
if (token) headers.Authorization = `Bearer ${token}`;
return headers;
} catch {}
return { "caller-interface": "web" };
}
})] });
}
//#endregion
export { trpc as n, getTrpcClient as t };