diff options
-rw-r--r-- | packages/demobank-ui/src/Routing.tsx | 2 | ||||
-rw-r--r-- | packages/demobank-ui/src/settings.ts | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/packages/demobank-ui/src/Routing.tsx b/packages/demobank-ui/src/Routing.tsx index 8ed66d4cf..aa46f2b7d 100644 --- a/packages/demobank-ui/src/Routing.tsx +++ b/packages/demobank-ui/src/Routing.tsx @@ -43,7 +43,7 @@ export function Routing(): VNode { const history = createHashHistory(); const backend = useBackendState(); const settings = useSettingsContext(); - const {config} = useBankCoreApiContext(); + const { config } = useBankCoreApiContext(); const { i18n } = useTranslationContext(); if (backend.state.status === "loggedOut") { 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) |