blob: 42f09eaa87dad3618ec46e666dce310c7d4cfc77 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/**
* Get API base URL from store
*/
import {
API_VERSION,
API,
} from '../environment';
const apiBase = () => {
let url;
if (!window.ferdi.stores.settings || !window.ferdi.stores.settings.all) {
// Stores have not yet been loaded - send invalid URL to force a retry when stores are loaded
url = 'https://localhost:9999';
} else if (window.ferdi.stores.settings.all.app.server) {
// Load URL from store
url = window.ferdi.stores.settings.all.app.server;
} else {
// Use default server url
url = API;
}
return `${url}/${API_VERSION}`;
};
export default apiBase;
|