Skip to content

Commit

Permalink
Merge pull request #97 from edx/sajjad/fix-reset-page-event
Browse files Browse the repository at this point in the history
fix: fix reset password page viewed event
  • Loading branch information
syedsajjadkazmii authored Jun 28, 2024
2 parents ed95f7c + 357382f commit 9eb35b9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/forms/reset-password-popup/reset-password/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { resetPassword, validatePassword, validateToken } from './data/reducers';
import { setCurrentOpenedForm } from '../../../authn-component/data/reducers';
import {
COMPLETE_STATE,
DEFAULT_STATE, FORGOT_PASSWORD_FORM, FORM_SUBMISSION_ERROR, LOGIN_FORM, PENDING_STATE,
} from '../../../data/constants';
import { useDispatch, useSelector } from '../../../data/storeHooks';
Expand Down Expand Up @@ -48,6 +49,7 @@ const ResetPasswordPage = () => {
const newPasswordRef = useRef(null);

const status = useSelector(state => state.resetPassword.status);
const tokenValidationState = useSelector(state => state.resetPassword.status);
const errorMsg = useSelector(state => state.resetPassword?.errorMsg);
const backendValidationError = useSelector(state => state.resetPassword?.backendValidationError);

Expand Down Expand Up @@ -79,8 +81,10 @@ const ResetPasswordPage = () => {
}, [status]);

useEffect(() => {
trackResetPasswordPageViewed();
}, []);
if (tokenValidationState === COMPLETE_STATE && status === TOKEN_STATE.VALID) {
trackResetPasswordPageViewed();
}
}, [status, tokenValidationState]);

const validateInput = (name, value, shouldValidateFromBackend = true) => {
switch (name) {
Expand Down

0 comments on commit 9eb35b9

Please sign in to comment.