aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/apiBase.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/apiBase.js')
-rw-r--r--src/api/apiBase.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/api/apiBase.js b/src/api/apiBase.js
index 842c85e56..ad37ca02c 100644
--- a/src/api/apiBase.js
+++ b/src/api/apiBase.js
@@ -5,6 +5,9 @@ import {
5 API_VERSION, 5 API_VERSION,
6} from '../environment'; 6} from '../environment';
7import { 7import {
8 DEV_API_FRANZ_WEBSITE,
9 LIVE_FRANZ_API,
10 LOCAL_HOSTNAME,
8 LOCAL_SERVER, 11 LOCAL_SERVER,
9 SERVER_NOT_LOADED, 12 SERVER_NOT_LOADED,
10} from '../config'; 13} from '../config';
@@ -21,16 +24,18 @@ const apiBase = (withVersion = true) => {
21 } 24 }
22 if (window.ferdi.stores.settings.all.app.server === LOCAL_SERVER) { 25 if (window.ferdi.stores.settings.all.app.server === LOCAL_SERVER) {
23 // Use URL for local server 26 // Use URL for local server
24 url = `http://127.0.0.1:${window.ferdi.stores.requests.localServerPort}`; 27 url = `http://${LOCAL_HOSTNAME}:${window.ferdi.stores.requests.localServerPort}`;
25 } else { 28 } else {
26 // Load URL from store 29 // Load URL from store
27 url = window.ferdi.stores.settings.all.app.server; 30 url = window.ferdi.stores.settings.all.app.server;
28 } 31 }
29 32
30 if (withVersion) { 33 return withVersion ? `${url}/${API_VERSION}` : url;
31 return `${url}/${API_VERSION}`;
32 }
33 return url;
34}; 34};
35 35
36export default apiBase; 36export default apiBase;
37
38export function termsBase() {
39 // TODO: This needs to handle local vs ferdi vs franz servers
40 return window.ferdi.stores.settings.all.app.server !== LIVE_FRANZ_API ? window.ferdi.stores.settings.all.app.server : DEV_API_FRANZ_WEBSITE;
41}