Skip to content

Commit

Permalink
Merge pull request #88 from openimis/feature/CM-213
Browse files Browse the repository at this point in the history
CM-213: Change moduleConfiguration reduce
  • Loading branch information
sniedzielski authored Jun 28, 2023
2 parents 4441533 + 0eaf26e commit e49cf32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/helpers/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const theme = createTheme({
drawer: {
width: 300,
fontSize: 16,
backgroundColor:"#006273"
},
appBar: {
fontSize: 16,
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

Expand Down

0 comments on commit e49cf32

Please sign in to comment.