From 95df3522a15631abc51a4295cae0ea401a8d4e1e Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Tue, 14 Sep 2021 19:58:52 +0200 Subject: feat: add eslint-plugin-unicorn (#1936) --- src/api/apiBase.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/api/apiBase.ts') 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 { // Note: This cannot be used from the internal-server since we are not running within the context of a browser window const apiBase = (withVersion = true) => { - let url: string; - if ( !(window as any).ferdi || !(window as any).ferdi.stores.settings || @@ -23,15 +21,12 @@ const apiBase = (withVersion = true) => { // Stores have not yet been loaded - return SERVER_NOT_LOADED to force a retry when stores are loaded return SERVER_NOT_LOADED; } - if ((window as any).ferdi.stores.settings.all.app.server === LOCAL_SERVER) { - // Use URL for local server - url = `http://${LOCAL_HOSTNAME}:${ - (window as any).ferdi.stores.requests.localServerPort - }`; - } else { - // Load URL from store - url = (window as any).ferdi.stores.settings.all.app.server; - } + const url = + (window as any).ferdi.stores.settings.all.app.server === LOCAL_SERVER + ? `http://${LOCAL_HOSTNAME}:${ + (window as any).ferdi.stores.requests.localServerPort + }` + : (window as any).ferdi.stores.settings.all.app.server; return withVersion ? `${url}/${API_VERSION}` : url; }; -- cgit v1.2.3-54-g00ecf