Files
cameleer-server/ui/src/config.ts
hsiegeln 7ebbc18b31
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m7s
CI / docker (push) Successful in 57s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 37s
fix: make API calls respect BASE_PATH for subpath deployments
config.apiBaseUrl now derives from <base> tag when no explicit config
is set (e.g., /server/api/v1 instead of /api/v1). commands.ts authFetch
prepends apiBaseUrl and uses relative paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 00:04:52 +02:00

20 lines
457 B
TypeScript

declare global {
interface Window {
__CAMELEER_CONFIG__?: {
apiBaseUrl?: string;
};
}
}
/** Base path from <base href="..."> tag, or '/' if none. Always ends with '/'. */
const basePath = document.querySelector('base')?.getAttribute('href') ?? '/';
export const config = {
get apiBaseUrl(): string {
return window.__CAMELEER_CONFIG__?.apiBaseUrl ?? `${basePath}api/v1`;
},
get basePath(): string {
return basePath;
},
};