From 0eaf26e7f70fd80b51eff197cf3e4d22cba9cbbb Mon Sep 17 00:00:00 2001 From: Damian Borowiecki Date: Wed, 28 Jun 2023 06:38:53 +0200 Subject: [PATCH] CM-213: Change moduleConfiguration reduce --- src/helpers/theme.js | 1 + src/index.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/helpers/theme.js b/src/helpers/theme.js index 27de3ca..8abb0ff 100644 --- a/src/helpers/theme.js +++ b/src/helpers/theme.js @@ -54,6 +54,7 @@ const theme = createTheme({ drawer: { width: 300, fontSize: 16, + backgroundColor:"#006273" }, appBar: { fontSize: 16, diff --git a/src/index.js b/src/index.js index 2a9b5ed..2545992 100644 --- a/src/index.js +++ b/src/index.js @@ -27,14 +27,16 @@ const loadConfiguration = async () => { throw response; } else { const { data } = await response.json(); - return data.moduleConfigurations.reduce((acc, c) => { + data.moduleConfigurations.unshift({}); + const out = data.moduleConfigurations.reduce((acc, c) => { try { acc[c.module] = { controls: c.controls, ...JSON.parse(c.config) }; } catch (error) { console.error(`Failed to parse module ${c.module} config`, error); } return acc; - }, []); + }); + return out; } };