demobank-ui: pass correct withdrawal ID instead of full URI

This commit is contained in:
Florian Dold 2023-02-26 14:00:41 +01:00
parent d11048b68c
commit 4dff3853c1
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
import { Logger } from "@gnu-taler/taler-util";
import { Logger, parseWithdrawUri } from "@gnu-taler/taler-util";
import {
HttpResponsePaginated,
useTranslationContext,
@ -59,25 +59,29 @@ export function WithdrawalQRCode({
logger.trace("withdrawal status", data);
if (data.aborted) {
//signal that this withdrawal is aborted
//will redirect to account info
// signal that this withdrawal is aborted
// will redirect to account info
onAbort();
return <Loading />;
}
const parsedUri = parseWithdrawUri(talerWithdrawUri);
if (!parsedUri) {
throw Error("can't parse withdrawal URI");
}
if (!data.selection_done) {
return (
<QrCodeSection talerWithdrawUri={talerWithdrawUri} onAbort={onAbort} />
);
}
/**
* Wallet POSTed the withdrawal details! Ask the
* user to authorize the operation (here CAPTCHA).
*/
// Wallet POSTed the withdrawal details! Ask the
// user to authorize the operation (here CAPTCHA).
return (
<WithdrawalConfirmationQuestion
account={account}
withdrawalId={talerWithdrawUri}
withdrawalId={parsedUri.withdrawalOperationId}
/>
);
}