From 6207b2b9a2778a51abf2e430290800db01125d24 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 16 Nov 2025 08:49:24 +0000 Subject: [PATCH] completionId: cgen-44527b5b7f3a4bf0aa205ab6a45371fd cgen-44527b5b7f3a4bf0aa205ab6a45371fd --- client/api/applications.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/api/applications.ts b/client/api/applications.ts index 030e363d..9a5fd589 100644 --- a/client/api/applications.ts +++ b/client/api/applications.ts @@ -44,7 +44,7 @@ export interface ApplicationWithCreator { }; } -const API_BASE = import.meta.env.VITE_API_BASE || ""; +const getApiBase = () => typeof window !== "undefined" ? window.location.origin : ""; export async function getMyApplications(filters?: { status?: string; @@ -105,8 +105,10 @@ export async function updateApplicationStatus( export async function withdrawApplication( applicationId: string, ): Promise { + const apiBase = getApiBase(); + if (!apiBase) throw new Error("No API base available"); const response = await fetch( - `${API_BASE}/api/applications/${applicationId}`, + `${apiBase}/api/applications/${applicationId}`, { method: "DELETE", },