From 44820f06be979d3a30d2e66c430e212e28ca6052 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Wed, 10 Jan 2024 14:44:10 -0300
Subject: save challenge id when 2fa is required

---
 packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx')

diff --git a/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx b/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx
index ed074b9c4..0ff1cf725 100644
--- a/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx
+++ b/packages/demobank-ui/src/pages/account/UpdateAccountPassword.tsx
@@ -10,6 +10,7 @@ import { ProfileNavigation } from "../ProfileNavigation.js";
 import { assertUnreachable } from "../WithdrawalOperationPage.js";
 import { LocalNotificationBanner } from "@gnu-taler/web-util/browser";
 import { HttpStatusCode, TalerErrorCode } from "@gnu-taler/taler-util";
+import { useBankState } from "../../hooks/bank-state.js";
 
 export function UpdateAccountPassword({
   account: accountName,
@@ -30,6 +31,7 @@ export function UpdateAccountPassword({
   const [current, setCurrent] = useState<string | undefined>();
   const [password, setPassword] = useState<string | undefined>();
   const [repeat, setRepeat] = useState<string | undefined>();
+  const [, updateBankState] = useBankState()
 
   const accountIsTheCurrentUser = credentials.status === "loggedIn" ?
     credentials.username === accountName : false
@@ -75,7 +77,7 @@ export function UpdateAccountPassword({
             title: i18n.str`Your current password doesn't match, can't change to a new password.`
           })
           case HttpStatusCode.Accepted: {
-            resp.body.challenge_id;
+            updateBankState("currentChallengeId", resp.body.challenge_id)
             return notify({
               type: "info",
               title: i18n.str`Cashout created but confirmation is required.`,
-- 
cgit v1.2.3

