diff --git a/apps/frontend/src/lib/trpc/getBaseUrl.ts b/apps/frontend/src/lib/trpc/getBaseUrl.ts index b52ba8cb..470368ef 100644 --- a/apps/frontend/src/lib/trpc/getBaseUrl.ts +++ b/apps/frontend/src/lib/trpc/getBaseUrl.ts @@ -1,4 +1,14 @@ export function getBaseUrl(): string { + const isProduction = process.env.NODE_ENV === "production"; + if (isProduction) { + if (typeof window !== "undefined") { + const customURL = localStorage.getItem("APP_URL"); + + // browser should use relative path + return customURL ? customURL : ""; + } + } + if (process.env.NEXT_PUBLIC_PROCESSOR_ENABLE_TRPC) { return `${process.env.NEXT_PUBLIC_PROCESSOR_URL}`; }