commit b269cfea9ee83e6f6e06a8c5b6c0c3573e666264
parent 66a345f66683a0f3b7358972b8b350d4e90eaa41
Author: ms <ms@taler.net>
Date: Wed, 12 Jan 2022 19:24:32 +0100
show public histories
Diffstat:
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/packages/bank/src/pages/home/index.tsx b/packages/bank/src/pages/home/index.tsx
@@ -640,6 +640,31 @@ function SWRWithCredentials(props: any): VNode {
}
/**
+ * Show histories of public accounts.
+ */
+export function PublicHistories(): VNode {
+
+ const { data, error } = useSWR(`access-api/public-accounts`);
+ if (typeof error !== "undefined") {
+ console.log("account error", error);
+ switch(error.status) {
+ case 404: {
+ return <p>List of public accounts was not found</p>
+ }
+ default: {
+ return <p>List of public accounts could not be retrieved.</p>
+ }
+ }
+ }
+ if (!data) return <p>Loading...</p>
+ var txs = [];
+ for (const account of data.publicAccounts) {
+ txs.push(<Transactions accountLabel={account.accountLabel} pageNumber={0} />)
+ }
+ return <div>{txs}</div>;
+}
+
+/**
* If the user is logged in, it displays
* the balance, otherwise it offers to login.
*/
@@ -777,6 +802,10 @@ export function BankHome(): VNode {
pageStateSetter
);
}}>{i18n`Sign in`}</button>
+ <div>
+ <p>{i18n`Public transactions:`}</p>
+ <PublicHistories />
+ </div>
</Fragment>
);
}