commit 93541e11d9d19ff578c89e8ffcf66bfd5ec91562 parent 6e66ec7c29be49f02a0cf28259031a02f2f69d65 Author: ms <ms@taler.net> Date: Tue, 15 Feb 2022 19:14:38 +0100 Show IBAN after login. Diffstat:
| M | packages/bank/src/pages/home/index.tsx | | | 13 | +++++++++++++ |
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/packages/bank/src/pages/home/index.tsx b/packages/bank/src/pages/home/index.tsx @@ -106,6 +106,18 @@ interface AccountStateType { ***********/ /** + * Extract IBAN from a Payto URI. + */ +function getIbanFromPayto(url: string): string { + const pathSplit = new URL(url).pathname.split("/"); + var lastIndex = pathSplit.length - 1; + // Happens if the path ends with "/". + if (pathSplit[lastIndex] === "") lastIndex--; + const iban = pathSplit[lastIndex]; + return iban; +} + +/** * Parse amount. */ function parseAmount(val: string): Amount { @@ -932,6 +944,7 @@ function Account(Props: any): VNode { } const balance = parseAmount(data.balance.amount) return (<Fragment> + <p>Hello {accountLabel}, {getIbanFromPayto(data.paytoUri)}.</p> <p>Your balance is {`${balance.value} ${balance.currency}`}.</p> <div> <span>{i18n`Last transactions:`}</span> { txsPages }