From 1ef0cc707ba76d8a9f1b533845a6c41f9b373dc7 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 16 Nov 2025 10:19:31 +0000 Subject: [PATCH] Create API base URL utility for all client code cgen-188cac9c01b24a52894ae0eae6b12663 --- client/lib/api-base.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 client/lib/api-base.ts diff --git a/client/lib/api-base.ts b/client/lib/api-base.ts new file mode 100644 index 00000000..340063d6 --- /dev/null +++ b/client/lib/api-base.ts @@ -0,0 +1,11 @@ +/** + * Get the API base URL + * Always uses window.location.origin since the API is served from the same origin + * This works for both development (localhost:8080) and production (aethex.dev) + */ +export function getApiBase(): string { + if (typeof window === "undefined") { + return ""; + } + return window.location.origin; +}