fix: welcome page redirection (#309)

* fix: welcome page redirection

Redirect ot finish auth URL if present upon clicking submit or skip
on welcome page.

* Update RedirectLogistration.jsx

nit
This commit is contained in:
Waheed Ahmed
2021-06-03 13:00:54 +05:00
committed by GitHub
parent 50bb65d4bd
commit 8aee3408cc
2 changed files with 21 additions and 21 deletions

View File

@@ -11,6 +11,7 @@ function RedirectLogistration(props) {
const {
finishAuthUrl, redirectUrl, redirectToWelcomePage, success,
} = props;
let finalRedirectUrl = '';
if (success) {
// If we're in a third party auth pipeline, we must complete the pipeline
@@ -18,15 +19,19 @@ function RedirectLogistration(props) {
// Note: For multiple enterprise use case, we need to make sure that user first visits the
// enterprise selection page and then complete the auth workflow
if (finishAuthUrl && !redirectUrl.includes(finishAuthUrl)) {
window.location.href = getConfig().LMS_BASE_URL + finishAuthUrl;
} else if (redirectToWelcomePage) {
const welcomeProps = { redirectUrl, success };
return <Redirect to={WELCOME_PAGE} registrationResult={welcomeProps} />;
finalRedirectUrl = getConfig().LMS_BASE_URL + finishAuthUrl;
} else {
finalRedirectUrl = redirectUrl;
}
if (redirectToWelcomePage) {
// use this component to redirect WelcomePage after successful registration
// return <Redirect to={WELCOME_PAGE} />;
window.location.href = redirectUrl;
const registrationResult = { redirectUrl: finalRedirectUrl, success };
return <Redirect to={{ pathname: WELCOME_PAGE, state: { registrationResult } }} />;
}
window.location.href = finalRedirectUrl;
}
return <></>;
}