1
0
mirror of https://github.com/hyperspacedev/hyperspace synced 2025-02-06 04:13:22 +01:00

Filter out "desktop" and "dynamic" in location (#193, HD-63 #in-review)

This commit is contained in:
Marquis Kurt 2020-04-13 09:55:11 -04:00
parent 9238f8851a
commit 564a9d26f9
No known key found for this signature in database
GPG Key ID: 725636D259F5402D

View File

@ -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<Config | undefined> {
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."
);