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>
This commit is contained in:
@@ -6,8 +6,14 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
/** 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 ?? '/api/v1';
|
||||
return window.__CAMELEER_CONFIG__?.apiBaseUrl ?? `${basePath}api/v1`;
|
||||
},
|
||||
get basePath(): string {
|
||||
return basePath;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user