diff options
author | Sebastian <sebasjm@gmail.com> | 2024-02-04 12:04:27 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-02-05 09:18:22 -0300 |
commit | b71d6f2b11342bd22197289ad3872d8a341686b5 (patch) | |
tree | d263482af0121d87000476fd0306530a77580817 /packages/demobank-ui/src/pages/WalletWithdrawForm.tsx | |
parent | 83ff7de59b8a00b313ecb00f4c6150a37c38902f (diff) | |
download | wallet-core-b71d6f2b11342bd22197289ad3872d8a341686b5.tar.gz wallet-core-b71d6f2b11342bd22197289ad3872d8a341686b5.tar.bz2 wallet-core-b71d6f2b11342bd22197289ad3872d8a341686b5.zip |
wip DD39: removed webRequest permission and changes made into demobank
Diffstat (limited to 'packages/demobank-ui/src/pages/WalletWithdrawForm.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/WalletWithdrawForm.tsx | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx index 1e48b818a..9f7f46c4f 100644 --- a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx +++ b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx @@ -21,6 +21,7 @@ import { TranslatedString, assertUnreachable, parseWithdrawUri, + stringifyWithdrawUri, } from "@gnu-taler/taler-util"; import { Attention, @@ -41,6 +42,8 @@ import { RouteDefinition } from "../route.js"; import { undefinedIfEmpty } from "../utils.js"; import { OperationState } from "./OperationState/index.js"; import { InputAmount, doAutoFocus } from "./PaytoWireTransferForm.js"; +import { useTalerWalletIntegrationAPI } from "../context/wallet-integration.js"; +import { useNavigationContext } from "../context/navigation.js"; const RefAmount = forwardRef(InputAmount); @@ -57,18 +60,32 @@ function OldWithdrawalForm({ }): VNode { const { i18n } = useTranslationContext(); const [settings] = usePreferences(); + + // const walletInegrationApi = useTalerWalletIntegrationAPI() + // const { navigateTo } = useNavigationContext(); + const [bankState, updateBankState] = useBankState(); + const { api } = useBankCoreApiContext(); const { state: credentials } = useBackendState(); const creds = credentials.status !== "loggedIn" ? undefined : credentials; - const { api } = useBankCoreApiContext(); const [amountStr, setAmountStr] = useState<string | undefined>( `${settings.maxWithdrawalAmount}`, ); const [notification, notify, handleError] = useLocalNotification(); if (bankState.currentWithdrawalOperationId) { + // FIXME: doing the preventDefault is not optimal + + // const suri = stringifyWithdrawUri({ + // bankIntegrationApiBaseUrl: api.getIntegrationAPI().baseUrl, + // withdrawalOperationId: bankState.currentWithdrawalOperationId, + // }); + // const uri = parseWithdrawUri(suri)! + const url = privatePages.operationDetails.url({ + wopid: bankState.currentWithdrawalOperationId, + }) return ( <Attention type="warning" title={i18n.str`There is an operation already`}> <span ref={focus ? doAutoFocus : undefined} /> @@ -77,9 +94,13 @@ function OldWithdrawalForm({ </i18n.Translate>{" "} <a class="font-semibold text-yellow-700 hover:text-yellow-600" - href={privatePages.operationDetails.url({ - wopid: bankState.currentWithdrawalOperationId, - })} + href={url} + // onClick={(e) => { + // e.preventDefault() + // walletInegrationApi.publishTalerAction(uri, () => { + // navigateTo(url) + // }) + // }} > <i18n.Translate>this page</i18n.Translate> </a> @@ -324,7 +345,7 @@ export function WalletWithdrawForm({ onAuthorizationRequired={onAuthorizationRequired} routeClose={routeCancel} onAbort={onOperationAborted} - // route={routeCancel} + // route={routeCancel} /> )} </div> |