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>
20 lines
457 B
TypeScript
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;
|
|
},
|
|
};
|