@seedgrid/fe-core 2026.4.25 → 2026.4.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http/api-client.js +11 -1
- package/package.json +1 -1
package/dist/http/api-client.js
CHANGED
|
@@ -218,8 +218,18 @@ function mergeHeaders(target, source) {
|
|
|
218
218
|
target.set(key, value);
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
|
+
function resolveAbsoluteBase(baseUrl) {
|
|
222
|
+
if (baseUrl.startsWith("http://") || baseUrl.startsWith("https://")) {
|
|
223
|
+
return baseUrl;
|
|
224
|
+
}
|
|
225
|
+
const origin = globalThis.window === undefined
|
|
226
|
+
? "http://localhost:3000"
|
|
227
|
+
: globalThis.window.location.origin;
|
|
228
|
+
return `${origin}${baseUrl}`;
|
|
229
|
+
}
|
|
221
230
|
function buildUrl(baseUrl, path, query) {
|
|
222
|
-
const
|
|
231
|
+
const resolved = resolveAbsoluteBase(baseUrl);
|
|
232
|
+
const base = resolved.endsWith("/") ? resolved : `${resolved}/`;
|
|
223
233
|
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
224
234
|
const url = new URL(normalizedPath, base);
|
|
225
235
|
for (const [key, value] of Object.entries(query ?? {})) {
|