diff options
author | Ricardo Cino <ricardo@cino.io> | 2022-07-07 09:31:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 09:31:50 +0200 |
commit | 71c52373f81cace664047edd19d9d289f45a4dff (patch) | |
tree | 69b3f1d45a8b3f1ceab9497ea3c96e9dc18e3166 /src/api | |
parent | 6.0.0-nightly.91 [skip ci] (diff) | |
download | ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.tar.gz ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.tar.zst ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.zip |
chore: Mobx & React-Router upgrade (#406)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/apiBase.ts | 3 | ||||
-rw-r--r-- | src/api/server/ServerApi.ts | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/api/apiBase.ts b/src/api/apiBase.ts index 918213542..701919785 100644 --- a/src/api/apiBase.ts +++ b/src/api/apiBase.ts | |||
@@ -23,6 +23,7 @@ export default function apiBase(withVersion = true) { | |||
23 | // Stores have not yet been loaded - return SERVER_NOT_LOADED to force a retry when stores are loaded | 23 | // Stores have not yet been loaded - return SERVER_NOT_LOADED to force a retry when stores are loaded |
24 | return SERVER_NOT_LOADED; | 24 | return SERVER_NOT_LOADED; |
25 | } | 25 | } |
26 | |||
26 | const url = | 27 | const url = |
27 | (window as any).ferdium.stores.settings.all.app.server === LOCAL_SERVER | 28 | (window as any).ferdium.stores.settings.all.app.server === LOCAL_SERVER |
28 | ? `http://${LOCAL_HOSTNAME}:${ | 29 | ? `http://${LOCAL_HOSTNAME}:${ |
@@ -34,7 +35,6 @@ export default function apiBase(withVersion = true) { | |||
34 | }; | 35 | }; |
35 | 36 | ||
36 | export function serverBase() { | 37 | export function serverBase() { |
37 | |||
38 | const serverType = (window as any).ferdium.stores.settings.all.app.server; | 38 | const serverType = (window as any).ferdium.stores.settings.all.app.server; |
39 | const noServer = 'You are using Ferdium without a server'; | 39 | const noServer = 'You are using Ferdium without a server'; |
40 | 40 | ||
@@ -54,7 +54,6 @@ export function serverBase() { | |||
54 | } | 54 | } |
55 | 55 | ||
56 | export function serverName(): string { | 56 | export function serverName(): string { |
57 | |||
58 | const serverType = (window as any).ferdium.stores.settings.all.app.server; | 57 | const serverType = (window as any).ferdium.stores.settings.all.app.server; |
59 | const noServer = 'You are using Ferdium without a server'; | 58 | const noServer = 'You are using Ferdium without a server'; |
60 | 59 | ||
diff --git a/src/api/server/ServerApi.ts b/src/api/server/ServerApi.ts index a636f3e0d..77a759b3e 100644 --- a/src/api/server/ServerApi.ts +++ b/src/api/server/ServerApi.ts | |||
@@ -291,6 +291,10 @@ export default class ServerApi { | |||
291 | 291 | ||
292 | // Features | 292 | // Features |
293 | async getDefaultFeatures() { | 293 | async getDefaultFeatures() { |
294 | if (apiBase() === SERVER_NOT_LOADED) { | ||
295 | throw new Error('Server not loaded'); | ||
296 | } | ||
297 | |||
294 | const request = await sendAuthRequest(`${apiBase()}/features/default`); | 298 | const request = await sendAuthRequest(`${apiBase()}/features/default`); |
295 | if (!request.ok) { | 299 | if (!request.ok) { |
296 | throw new Error(request.statusText); | 300 | throw new Error(request.statusText); |