From 80bfbea1c612ecf8f6889f65367e7216c12124eb Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 16 Nov 2025 08:49:27 +0000 Subject: [PATCH] completionId: cgen-8615ea720f914b8fb788e25f8e82195b cgen-8615ea720f914b8fb788e25f8e82195b --- client/api/creators.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/api/creators.ts b/client/api/creators.ts index b36b62ac..7b3262c4 100644 --- a/client/api/creators.ts +++ b/client/api/creators.ts @@ -51,7 +51,7 @@ export interface CreatorsResponse { }; } -const API_BASE = import.meta.env.VITE_API_BASE || ""; +const getApiBase = () => typeof window !== "undefined" ? window.location.origin : ""; export async function getCreators(filters?: { arm?: string; @@ -168,8 +168,10 @@ export async function endorseSkill( creatorId: string, skill: string, ): Promise { + const apiBase = getApiBase(); + if (!apiBase) throw new Error("No API base available"); const response = await fetch( - `${API_BASE}/api/creators/${creatorId}/endorse`, + `${apiBase}/api/creators/${creatorId}/endorse`, { method: "POST", headers: { "Content-Type": "application/json" },