blob: ab47c78eebefe8152ecbdc90068f0e6f6eb6e02b (
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
26
27
|
/**
* Get API base URL from store
*/
import {
API_VERSION,
API,
} from '../environment';
const apiBase = () => {
let url;
if (!window.ferdi ||
!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://1.1.1.1';
} 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;
|