From 7435d9841014bae5f587be0f5be21672b7dcd9e8 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 16 Nov 2025 09:36:42 +0000 Subject: [PATCH] completionId: cgen-bf92ab2e108d4ecf9503893c38d63427 cgen-bf92ab2e108d4ecf9503893c38d63427 --- client/pages/SubdomainPassport.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/pages/SubdomainPassport.tsx b/client/pages/SubdomainPassport.tsx index 46fa990d..2fad9f8f 100644 --- a/client/pages/SubdomainPassport.tsx +++ b/client/pages/SubdomainPassport.tsx @@ -10,7 +10,7 @@ import FourOhFourPage from "@/pages/404"; import Index from "@/pages/Index"; import type { AethexUserProfile } from "@/lib/aethex-database-adapter"; -const API_BASE = import.meta.env.VITE_API_BASE || ""; +const getApiBase = () => typeof window !== "undefined" ? window.location.origin : ""; interface CreatorPassportResponse { type: "creator"; @@ -105,13 +105,20 @@ const SubdomainPassport = () => { setLoading(true); setError(null); + const apiBase = getApiBase(); + if (!apiBase) { + setError("Cannot determine API base"); + setLoading(false); + return; + } + let url = ""; if (subdomainInfo.isCreatorPassport) { - url = `${API_BASE}/api/passport/subdomain/${encodeURIComponent( + url = `${apiBase}/api/passport/subdomain/${encodeURIComponent( subdomainInfo.subdomain, )}`; } else if (subdomainInfo.isProjectPassport) { - url = `${API_BASE}/api/passport/group/${encodeURIComponent( + url = `${apiBase}/api/passport/group/${encodeURIComponent( subdomainInfo.subdomain, )}`; }