settings work
This commit is contained in:
13
electron-ui/src/renderer/api.ts
Normal file
13
electron-ui/src/renderer/api.ts
Normal file
@ -0,0 +1,13 @@
|
||||
const getBaseUrl = () => {
|
||||
// You can store the base URL in localStorage, a config file, or state
|
||||
return localStorage.getItem('baseUrl') || 'http://localhost:5010';
|
||||
};
|
||||
|
||||
export function apiFetch(endpoint: string, options = {}) {
|
||||
const url = `${getBaseUrl()}/${endpoint}`;
|
||||
return fetch(url, options);
|
||||
}
|
||||
|
||||
export function setBaseUrl(baseUrl: string) {
|
||||
localStorage.setItem('baseUrl', baseUrl);
|
||||
}
|
||||
Reference in New Issue
Block a user