gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: fix codec was setting values


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix codec was setting values to undefined
Date: Wed, 06 Dec 2023 19:12:05 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new dc02188d6 fix codec was setting values to undefined
dc02188d6 is described below

commit dc02188d6bcae8446b27f0a094076fdd006931d1
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Dec 6 15:11:38 2023 -0300

    fix codec was setting values to undefined
---
 packages/demobank-ui/src/Routing.tsx |  2 +-
 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)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]