From 66bbe9148927cf4f2d3eeb77fa93b3df70652876 Mon Sep 17 00:00:00 2001 From: mashal-m Date: Wed, 10 Jan 2024 17:03:12 +0500 Subject: [PATCH] feat: replace legacy url with account mfe url --- src/account-settings/name-change/NameChange.jsx | 2 +- src/hooks.js | 2 ++ src/id-verification/panels/SubmittedPanel.jsx | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/account-settings/name-change/NameChange.jsx b/src/account-settings/name-change/NameChange.jsx index 35bbda4..1235c2a 100644 --- a/src/account-settings/name-change/NameChange.jsx +++ b/src/account-settings/name-change/NameChange.jsx @@ -69,7 +69,7 @@ const NameChangeModal = ({ useEffect(() => { if (saveState === 'complete') { handleClose(); - navigate(`/id-verification?next=${encodeURIComponent('account/settings')}`); + navigate(`/id-verification?next=${encodeURIComponent('/')}`); } }, [handleClose, navigate, saveState]); diff --git a/src/hooks.js b/src/hooks.js index 6d3feca..dbc1493 100644 --- a/src/hooks.js +++ b/src/hooks.js @@ -42,11 +42,13 @@ export function useRedirect() { useEffect(() => { if (sessionStorage.getItem('courseId')) { setRedirect({ + isAccountMFERedirect: false, location: `courses/${sessionStorage.getItem('courseId')}`, text: 'id.verification.return.course', }); } else if (sessionStorage.getItem('next')) { setRedirect({ + isAccountMFERedirect: true, location: sessionStorage.getItem('next'), text: 'id.verification.return.generic', }); diff --git a/src/id-verification/panels/SubmittedPanel.jsx b/src/id-verification/panels/SubmittedPanel.jsx index 6397e07..a6aa786 100644 --- a/src/id-verification/panels/SubmittedPanel.jsx +++ b/src/id-verification/panels/SubmittedPanel.jsx @@ -12,8 +12,9 @@ import BasePanel from './BasePanel'; const SubmittedPanel = (props) => { const { userId } = useContext(IdVerificationContext); - const { location: returnUrl, text: returnText } = useRedirect(); + const { location: returnUrl, text: returnText, isAccountMFERedirect } = useRedirect(); const panelSlug = 'submitted'; + const URL = isAccountMFERedirect ? returnUrl : `${getConfig().LMS_BASE_URL}/${returnUrl}`; useEffect(() => { sendTrackEvent('edx.id_verification.submitted', { @@ -32,7 +33,7 @@ const SubmittedPanel = (props) => {

{props.intl.formatMessage(messages[returnText])}