From 564a9d26f9f7d81978863618f299cb7180368e2c Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Mon, 13 Apr 2020 09:55:11 -0400 Subject: [PATCH] Filter out "desktop" and "dynamic" in location (#193, HD-63 #in-review) --- src/utilities/settings.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utilities/settings.tsx b/src/utilities/settings.tsx index 5243875..0fdb752 100644 --- a/src/utilities/settings.tsx +++ b/src/utilities/settings.tsx @@ -133,16 +133,20 @@ export function createUserDefaults() { } /** - * Gets the configuration data from `config.json` + * Gets the configuration data from `config.json`. + * + * In scenarios where the app is being run from the desktop or from a local React server + * started by react-scripts, the location field is adjusted accordingly. + * * @returns The Promise data from getting the config. */ export async function getConfig(): Promise { try { const resp = await axios.get("config.json"); - let { location } = resp.data; + let { location }: { location: string } = resp.data; - if (!location.endsWith("/")) { + if (!location.endsWith("/") && (location !== "desktop" && location !== "dynamic")) { console.info( "Location does not have a backslash, so Hyperspace has added it automatically." );