2025-07-22 16:21:29 +01:00
|
|
|
// Runtime configuration access
|
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
runtimeConfig?: {
|
|
|
|
apiBaseUrl?: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2025-07-01 14:22:19 +01:00
|
|
|
|
|
|
|
export const makeApiUrl = (endpoint: string): string => {
|
2025-07-22 16:39:23 +01:00
|
|
|
|
|
|
|
//const baseUrl = window.runtimeConfig?.apiBaseUrl || 'http://localhost:8080';
|
|
|
|
|
|
|
|
if (typeof window !== 'undefined' && (window.__TAURI__ || window.__TAURI_INTERNALS__)) {
|
|
|
|
// If running in Tauri, use the Tauri API base URL
|
|
|
|
const tauriApiBaseUrl = 'http://localhost:8080';
|
|
|
|
return `${tauriApiBaseUrl}${endpoint}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return `${endpoint}`;
|
2025-07-01 14:22:19 +01:00
|
|
|
};
|