diff options
Diffstat (limited to 'packages/challenger-ui/src/pages')
-rw-r--r-- | packages/challenger-ui/src/pages/AnswerChallenge.tsx | 29 | ||||
-rw-r--r-- | packages/challenger-ui/src/pages/AskChallenge.tsx | 20 |
2 files changed, 29 insertions, 20 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) => { diff --git a/packages/challenger-ui/src/pages/AskChallenge.tsx b/packages/challenger-ui/src/pages/AskChallenge.tsx index 30b50d707..c2ef43615 100644 --- a/packages/challenger-ui/src/pages/AskChallenge.tsx +++ b/packages/challenger-ui/src/pages/AskChallenge.tsx @@ -87,21 +87,23 @@ export function AskChallenge({ return lib.challenger.challenge(nonce, { email: email! }); }, (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.); + // } else { + accepted({ + attemptsLeft: ok.body.attempts_left, + nextSend: ok.body.next_tx_time, + transmitted: ok.body.transmitted, + }); + // } onSendSuccesful(); }, (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: |