gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant-backoffice] branch master updated: fix shown public acco


From: gnunet
Subject: [taler-merchant-backoffice] branch master updated: fix shown public account in the state
Date: Tue, 19 Apr 2022 18:27:48 +0200

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

ms pushed a commit to branch master
in repository merchant-backoffice.

The following commit(s) were added to refs/heads/master by this push:
     new d6b7197  fix shown public account in the state
d6b7197 is described below

commit d6b719772d37848192d92bad2ef6f3697606b24d
Author: ms <ms@taler.net>
AuthorDate: Tue Apr 19 18:27:43 2022 +0200

    fix shown public account in the state
---
 packages/bank/src/pages/home/index.tsx | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/packages/bank/src/pages/home/index.tsx 
b/packages/bank/src/pages/home/index.tsx
index 60f669c..8978003 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -248,6 +248,24 @@ const getRootPath = () => {
  * State managers. *
  ******************/
 
+/**
+ * Stores in the state a object containing a 'username'
+ * and 'password' field, in order to avoid losing the
+ * handle of the data entered by the user in <input> fields.
+ */
+function useShowPublicAccount(
+  state?: string
+): [string | undefined, StateUpdater<string | undefined>] {
+
+  const ret = useLocalStorage("show-public-account", JSON.stringify(state));
+  const retObj: string | undefined = ret[0] ? JSON.parse(ret[0]) : ret[0];
+  const retSetter: StateUpdater<string | undefined> = function(val) {
+    const newVal = val instanceof Function ? JSON.stringify(val(retObj)) : 
JSON.stringify(val)
+    ret[1](newVal)
+  }
+  return [retObj, retSetter]
+}
+
 /**
  * Stores in the state a object containing a 'username'
  * and 'password' field, in order to avoid losing the
@@ -1510,7 +1528,7 @@ function SWRWithoutCredentials(Props: any): VNode {
  * Show histories of public accounts.
  */
 function PublicHistories(Props: any): VNode {
-  const [showAccount, setShowAccount] = useState<string | undefined>();
+  const [showAccount, setShowAccount] = useShowPublicAccount();
   const { data, error } = useSWR("access-api/public-accounts");
   const i18n = useTranslator();
 

-- 
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]