diff options
author | Sebastian <sebasjm@gmail.com> | 2024-06-25 18:03:47 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-06-25 18:03:47 -0300 |
commit | 83680013581a530ccaa014ed4a94985453e45123 (patch) | |
tree | aac8212c66f51cad5eca665dd228b371eeb46871 /packages/challenger-ui/src/pages/AnswerChallenge.tsx | |
parent | 4bb0adb96516a55c3036252ac088493b3d6155da (diff) | |
download | wallet-core-83680013581a530ccaa014ed4a94985453e45123.tar.xz |
new json api
Diffstat (limited to 'packages/challenger-ui/src/pages/AnswerChallenge.tsx')
-rw-r--r-- | packages/challenger-ui/src/pages/AnswerChallenge.tsx | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/packages/challenger-ui/src/pages/AnswerChallenge.tsx b/packages/challenger-ui/src/pages/AnswerChallenge.tsx index 73a79c51f..9788ea8a5 100644 --- a/packages/challenger-ui/src/pages/AnswerChallenge.tsx +++ b/packages/challenger-ui/src/pages/AnswerChallenge.tsx @@ -41,7 +41,12 @@ type Props = { routeAsk: RouteDefinition<{ nonce: string }>; }; -export function AnswerChallenge({ focus, nonce, onComplete, routeAsk }: Props): VNode { +export function AnswerChallenge({ + focus, + nonce, + onComplete, + routeAsk, +}: Props): VNode { const { lib } = useChallengerApiContext(); const { i18n } = useTranslationContext(); const { state, accepted, completed } = useSessionState(); @@ -70,21 +75,23 @@ export function AnswerChallenge({ focus, nonce, onComplete, routeAsk }: Props): return await lib.challenger.challenge(nonce, { email: lastEmail }); }, (ok) => { - if ("redirectURL" in ok.body) { - completed(ok.body.redirectURL); - } else { - accepted({ - attemptsLeft: ok.body.attempts_left, - nextSend: ok.body.next_tx_time, - transmitted: ok.body.transmitted, - }); - } + // if ("redirectURL" in ok.body) { + // completed(ok.body.redirectURL); + // } else { + accepted({ + attemptsLeft: ok.body.attempts_left, + nextSend: ok.body.next_tx_time, + transmitted: ok.body.transmitted, + }); + // } return undefined; }, (fail) => { switch (fail.case) { case HttpStatusCode.BadRequest: return i18n.str``; + case HttpStatusCode.Forbidden: + return i18n.str``; case HttpStatusCode.NotFound: return i18n.str``; case HttpStatusCode.NotAcceptable: @@ -105,7 +112,7 @@ export function AnswerChallenge({ focus, nonce, onComplete, routeAsk }: Props): return lib.challenger.solve(nonce, { pin: pin! }); }, (ok) => { - completed(ok.body.redirectURL as URL); + completed(new URL(ok.body.redirect_url)); onComplete(); }, (fail) => { |