Files
ClipTrimApp/electron-ui/src/renderer/api.ts
2026-02-24 18:08:58 -05:00

14 lines
427 B
TypeScript

const getBaseUrl = async () => {
const port = await window.audio.getPort();
if (port.error || !port.port) {
return `http://localhost:5010`;
}
// You can store the base URL in localStorage, a config file, or state
return `http://localhost:${port.port}`;
};
export default async function apiFetch(endpoint: string, options = {}) {
const url = `${await getBaseUrl()}/${endpoint}`;
return fetch(url, options);
}