hardcode
This commit is contained in:
@@ -1,11 +1,22 @@
|
|||||||
import { createTRPCProxyClient, httpBatchLink, loggerLink } from "@trpc/client";
|
import { createTRPCProxyClient, httpBatchLink, loggerLink } from "@trpc/client";
|
||||||
import { AppRouter } from "~/server/api/root";
|
import { AppRouter } from "~/server/api/root";
|
||||||
|
|
||||||
|
const getBaseUrl = () => {
|
||||||
|
// Browser: use relative URL
|
||||||
|
if (typeof window !== "undefined") return "";
|
||||||
|
|
||||||
|
//const domain = import.meta.env.VITE_DOMAIN;
|
||||||
|
const domain = "https://freno.dev"; // try to hardcode it for now
|
||||||
|
if (domain) return domain;
|
||||||
|
|
||||||
|
return `http://localhost:${process.env.PORT ?? 3000}`;
|
||||||
|
};
|
||||||
|
|
||||||
export const api = createTRPCProxyClient<AppRouter>({
|
export const api = createTRPCProxyClient<AppRouter>({
|
||||||
links: [
|
links: [
|
||||||
// will print out helpful logs when using client
|
// will print out helpful logs when using client
|
||||||
loggerLink(),
|
loggerLink(),
|
||||||
// identifies what url will handle trpc requests
|
// identifies what url will handle trpc requests
|
||||||
httpBatchLink({ url: `${import.meta.env.VITE_DOMAIN}/api/trpc` })
|
httpBatchLink({ url: `${getBaseUrl()}/api/trpc` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user