Files
cameleer-server/ui/src/config.ts

20 lines
457 B
TypeScript
Raw Normal View History

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;
},
};