Skip to content

Commit

Permalink
Merge pull request #5268 from flexion/10353-bug-duplicate-cognito-use…
Browse files Browse the repository at this point in the history
…rs-intermediate-branch-to-test-1724189234

10353 Bug: Duplicate Cognito Users update (fix re-enable logic of submit button)
  • Loading branch information
Mwindo authored Aug 21, 2024
2 parents adacbff + c225808 commit 57d10f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('Petitioner Account Creation', () => {
cy.get('@accountCreationRequest.all').should('have.length', 1);
});

it('should create an account and verify it using the verification link, then login and create an eletronic case', () => {
it('should create an account and verify it using the verification link, then login and create an electronic case', () => {
const TEST_EMAIL = `cypress_test_account+success_${GUID}@example.com`;
createAPetitioner({
email: TEST_EMAIL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { RequirementsText } from '@web-client/views/CreatePetitionerAccount/Requ
import { connect } from '@web-client/presenter/shared.cerebral';
import { debounce } from 'lodash';
import { sequences, state } from '@web-client/presenter/app.cerebral';
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';

export const CreatePetitionerAccountForm = connect(
{
alertError: state.alertError,
alertWarning: state.alertWarning,
confirmPassword: state.form.confirmPassword,
createAccountHelper: state.createAccountHelper,
navigateToLoginSequence: sequences.navigateToLoginSequence,
Expand All @@ -19,6 +21,8 @@ export const CreatePetitionerAccountForm = connect(
updateFormValueSequence: sequences.updateFormValueSequence,
},
({
alertError,
alertWarning,
confirmPassword,
createAccountHelper,
navigateToLoginSequence,
Expand All @@ -33,9 +37,15 @@ export const CreatePetitionerAccountForm = connect(
const [inFocusName, setInFocusName] = useState(true);
const [submitDisabled, setSubmitDisabled] = useState(false);

// Re-enabled submit button if submission was unsuccessful
useEffect(() => {
if (alertError || alertWarning) {
setSubmitDisabled(false);
}
}, [alertError, alertWarning]);

const submitFunction = debounce(() => {
submitCreatePetitionerAccountFormSequence();
setSubmitDisabled(false);
}, 500);

return (
Expand Down

0 comments on commit 57d10f3

Please sign in to comment.