diff options
Diffstat (limited to 'packages/demobank-ui/src/settings.ts')
-rw-r--r-- | packages/demobank-ui/src/settings.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/demobank-ui/src/settings.ts b/packages/demobank-ui/src/settings.ts index b7d285519..2c6ac1c67 100644 --- a/packages/demobank-ui/src/settings.ts +++ b/packages/demobank-ui/src/settings.ts @@ -64,13 +64,22 @@ const codecForBankUISettings = (): Codec<BankUiSettings> => .property("topNavSites", codecOptional(codecForMap(codecForString()))) .build("BankUiSettings"); +function removeUndefineField(obj: any): object { + return Object.keys(obj).reduce((prev, cur) => { + if (typeof prev[cur] === "undefined") { + delete prev[cur] + } + return prev + }, obj) +} + export function fetchSettings(listener: (s: BankUiSettings) => void): void { fetch("./settings.json") .then(resp => resp.json()) .then(json => codecForBankUISettings().decode(json)) .then(result => listener({ ...defaultSettings, - ...result, + ...removeUndefineField(result), })) .catch(e => { console.log("failed to fetch settings", e) |