diff options
author | 2021-09-14 19:58:52 +0200 | |
---|---|---|
committer | 2021-09-14 19:58:52 +0200 | |
commit | 95df3522a15631abc51a4295cae0ea401a8d4e1e (patch) | |
tree | e5eb0f368c947683f01458e912f21756fb0d99cb /src/api/apiBase.ts | |
parent | docs: add sad270 as a contributor for bug, userTesting [skip ci] (#1941) (diff) | |
download | ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.gz ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.zst ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.zip |
feat: add eslint-plugin-unicorn (#1936)
Diffstat (limited to 'src/api/apiBase.ts')
-rw-r--r-- | src/api/apiBase.ts | 17 |
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 |
14 | const apiBase = (withVersion = true) => { | 14 | const 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 | }; |