diff options
Diffstat (limited to 'src/api/apiBase.js')
-rw-r--r-- | src/api/apiBase.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/api/apiBase.js b/src/api/apiBase.js index ce02922ac..b40673e44 100644 --- a/src/api/apiBase.js +++ b/src/api/apiBase.js | |||
@@ -8,9 +8,11 @@ import { | |||
8 | 8 | ||
9 | const apiBase = () => { | 9 | const apiBase = () => { |
10 | let url; | 10 | let url; |
11 | |||
11 | if (!window.ferdi | 12 | if (!window.ferdi |
12 | || !window.ferdi.stores.settings | 13 | || !window.ferdi.stores.settings |
13 | || !window.ferdi.stores.settings.all) { | 14 | || !window.ferdi.stores.settings.all |
15 | || !window.ferdi.stores.settings.all.app.server) { | ||
14 | // Stores have not yet been loaded - send invalid URL to force a retry when stores are loaded | 16 | // Stores have not yet been loaded - send invalid URL to force a retry when stores are loaded |
15 | // "Why 1.1.1.1 as the default, invalid URL?" | 17 | // "Why 1.1.1.1 as the default, invalid URL?" |
16 | // 1.1.1.1 is the server for Cloudflare's DNS service and will be the same across most networks. | 18 | // 1.1.1.1 is the server for Cloudflare's DNS service and will be the same across most networks. |
@@ -20,12 +22,9 @@ const apiBase = () => { | |||
20 | // on some routes. This would result in Ferdi deleting its current authToken as it thinks it | 22 | // on some routes. This would result in Ferdi deleting its current authToken as it thinks it |
21 | // has gone invalid. | 23 | // has gone invalid. |
22 | url = 'https://1.1.1.1'; | 24 | url = 'https://1.1.1.1'; |
23 | } else if (window.ferdi.stores.settings.all.app.server) { | 25 | } else { |
24 | // Load URL from store | 26 | // Load URL from store |
25 | url = window.ferdi.stores.settings.all.app.server; | 27 | url = window.ferdi.stores.settings.all.app.server; |
26 | } else { | ||
27 | // Use default server url | ||
28 | url = API; | ||
29 | } | 28 | } |
30 | 29 | ||
31 | return `${url}/${API_VERSION}`; | 30 | return `${url}/${API_VERSION}`; |