completionId: cgen-8615ea720f914b8fb788e25f8e82195b

cgen-8615ea720f914b8fb788e25f8e82195b
This commit is contained in:
Builder.io 2025-11-16 08:49:27 +00:00
parent 6207b2b9a2
commit 80bfbea1c6

View file

@ -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<void> {
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" },