From 4630ea3999ab8871d037a9d99f1f021f4278eb34 Mon Sep 17 00:00:00 2001 From: Manohar Gupta Date: Sun, 24 May 2026 00:32:41 +0530 Subject: [PATCH] Fix API_BASE to use relative path for production --- packages/web/components/ProfileViewer.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/web/components/ProfileViewer.tsx b/packages/web/components/ProfileViewer.tsx index 633d4eb..83545c5 100644 --- a/packages/web/components/ProfileViewer.tsx +++ b/packages/web/components/ProfileViewer.tsx @@ -86,7 +86,9 @@ export function ProfileViewer() { const [isLoadingFile, setIsLoadingFile] = useState(false); const API_BASE = typeof window !== "undefined" - ? ((window as unknown as { NEXT_PUBLIC_API_URL?: string }).NEXT_PUBLIC_API_URL || "http://localhost:8000") + ? (typeof window !== "undefined" && (window as { location?: { hostname?: string } }).location?.hostname === "localhost" + ? "http://localhost:8000" + : (window as { env?: { NEXT_PUBLIC_API_URL?: string } }).env?.NEXT_PUBLIC_API_URL || "/") : "http://localhost:8000"; async function fetchAndDisplayFile(path: string, name: string) {