From 23e14662e558a583588b7e6eb80dd45468ce125d Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Tue, 22 Jun 2021 23:05:51 +0100 Subject: [PATCH] :bug: Fix issue being thrown when appConfig is undefined --- src/utils/ConfigAccumalator.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/ConfigAccumalator.js b/src/utils/ConfigAccumalator.js index 85255589..0e04c2b6 100644 --- a/src/utils/ConfigAccumalator.js +++ b/src/utils/ConfigAccumalator.js @@ -11,16 +11,17 @@ import conf from '../../public/conf.yml'; * Returns the appConfig section, as JSON */ export const appConfig = (() => { + const appConfigFile = conf.appConfig || {}; let usersAppConfig = Defaults.appConfig; if (localStorage[localStorageKeys.APP_CONFIG]) { usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]); - } else if (conf.appConfig) { - usersAppConfig = conf.appConfig; + } else if (appConfigFile !== {}) { + usersAppConfig = appConfigFile; } usersAppConfig.layout = localStorage[localStorageKeys.LAYOUT_ORIENTATION] - || conf.appConfig.layout || Defaults.layout; + || appConfigFile.layout || Defaults.layout; usersAppConfig.iconSize = localStorage[localStorageKeys.ICON_SIZE] - || conf.appConfig.iconSize || Defaults.iconSize; + || appConfigFile.iconSize || Defaults.iconSize; return usersAppConfig; })();