feat: add environment configuration files and update API base URL handling for production

This commit is contained in:
JSC
2025-08-09 14:43:09 +02:00
parent b43d29e862
commit d53c08d7a0
10 changed files with 55 additions and 8 deletions

View File

@@ -12,7 +12,15 @@ export class BaseApiClient implements ApiClient {
}
private buildURL(endpoint: string, params?: Record<string, string | number | boolean | undefined>): string {
const url = new URL(endpoint, this.baseURL)
let url: URL
if (this.baseURL) {
// Full base URL provided
url = new URL(endpoint, this.baseURL)
} else {
// Use relative URL (for reverse proxy)
url = new URL(endpoint, window.location.origin)
}
if (params) {
Object.entries(params).forEach(([key, value]) => {
@@ -22,7 +30,7 @@ export class BaseApiClient implements ApiClient {
})
}
return url.toString()
return this.baseURL ? url.toString() : url.pathname + url.search
}
private async request<T>(