Skip to content

Commit

Permalink
Fix processing of IVA creation response (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Jun 14, 2024
1 parent 668cf81 commit 838d242
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-portal-ui",
"version": "1.1.6",
"version": "1.1.7",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "~6.4.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,18 @@ const IvaManagerListCreateCodeModal = (
try {
const response = await fetchJson(url, method);
if (response && response.status === ok) {
const code = await response.json();
const responseObj = await response.json();
const code = responseObj.verification_code;
if (!code) {
throw new Error("No verification code returned");
}
setCode(code);
selectedIVA.state = IVAState.CodeCreated;
onUpdate();
setDisabledButtons(false);
} else throw new Error("POST failed: " + response.text);
} else {
throw new Error("Verification code could not be created: " + response.text);
}
} catch (error) {
console.error(error);
showMessage({
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/responses.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const responses = {
"POST /api/auth/rpc/ivas/*/request-code": 204,

// Create IVA verification code
"POST /api/auth/rpc/ivas/*/create-code": "TEST1234566789",
"POST /api/auth/rpc/ivas/*/create-code": {verification_code: "TEST1234566789"},

// Request IVA verification
"POST /api/auth/rpc/ivas/*/code-transmitted": 204,
Expand Down

0 comments on commit 838d242

Please sign in to comment.