aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/apiBase.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/apiBase.ts')
-rw-r--r--src/api/apiBase.ts17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/api/apiBase.ts b/src/api/apiBase.ts
index dc10fad91..510ccb619 100644
--- a/src/api/apiBase.ts
+++ b/src/api/apiBase.ts
@@ -12,8 +12,6 @@ import {
12 12
13// Note: This cannot be used from the internal-server since we are not running within the context of a browser window 13// Note: This cannot be used from the internal-server since we are not running within the context of a browser window
14const apiBase = (withVersion = true) => { 14const apiBase = (withVersion = true) => {
15 let url: string;
16
17 if ( 15 if (
18 !(window as any).ferdi || 16 !(window as any).ferdi ||
19 !(window as any).ferdi.stores.settings || 17 !(window as any).ferdi.stores.settings ||
@@ -23,15 +21,12 @@ const apiBase = (withVersion = true) => {
23 // Stores have not yet been loaded - return SERVER_NOT_LOADED to force a retry when stores are loaded 21 // Stores have not yet been loaded - return SERVER_NOT_LOADED to force a retry when stores are loaded
24 return SERVER_NOT_LOADED; 22 return SERVER_NOT_LOADED;
25 } 23 }
26 if ((window as any).ferdi.stores.settings.all.app.server === LOCAL_SERVER) { 24 const url =
27 // Use URL for local server 25 (window as any).ferdi.stores.settings.all.app.server === LOCAL_SERVER
28 url = `http://${LOCAL_HOSTNAME}:${ 26 ? `http://${LOCAL_HOSTNAME}:${
29 (window as any).ferdi.stores.requests.localServerPort 27 (window as any).ferdi.stores.requests.localServerPort
30 }`; 28 }`
31 } else { 29 : (window as any).ferdi.stores.settings.all.app.server;
32 // Load URL from store
33 url = (window as any).ferdi.stores.settings.all.app.server;
34 }
35 30
36 return withVersion ? `${url}/${API_VERSION}` : url; 31 return withVersion ? `${url}/${API_VERSION}` : url;
37}; 32};