Removes [http-cache-semantics](https://github.com/kornelski/http-cache-semantics). It's no longer used after updating ancestor dependency [@edx/frontend-build](https://github.com/openedx/frontend-build). These dependencies need to be updated together. Removes `http-cache-semantics` Updates `@edx/frontend-build` from 11.0.2 to 12.7.0 - [Release notes](https://github.com/openedx/frontend-build/releases) - [Commits](https://github.com/openedx/frontend-build/compare/v11.0.2...v12.7.0) --- updated-dependencies: - dependency-name: http-cache-semantics dependency-type: indirect - dependency-name: "@edx/frontend-build" dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
96 lines
2.6 KiB
JavaScript
96 lines
2.6 KiB
JavaScript
import React from 'react';
|
|
|
|
import { getConfig } from '@edx/frontend-platform';
|
|
import PropTypes from 'prop-types';
|
|
import { Redirect } from 'react-router-dom';
|
|
|
|
import { AUTHN_PROGRESSIVE_PROFILING, RECOMMENDATIONS } from '../data/constants';
|
|
import { setCookie } from '../data/utils';
|
|
|
|
const RedirectLogistration = (props) => {
|
|
const {
|
|
finishAuthUrl,
|
|
redirectUrl,
|
|
redirectToProgressiveProfilingPage,
|
|
success,
|
|
optionalFields,
|
|
redirectToRecommendationsPage,
|
|
educationLevel,
|
|
userId,
|
|
} = props;
|
|
let finalRedirectUrl = '';
|
|
|
|
if (success) {
|
|
// If we're in a third party auth pipeline, we must complete the pipeline
|
|
// once user has successfully logged in. Otherwise, redirect to the specified redirect url.
|
|
// 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)) {
|
|
finalRedirectUrl = getConfig().LMS_BASE_URL + finishAuthUrl;
|
|
} else {
|
|
finalRedirectUrl = redirectUrl;
|
|
}
|
|
|
|
// Redirect to Progressive Profiling after successful registration
|
|
if (redirectToProgressiveProfilingPage) {
|
|
// TODO: Do we still need this cookie?
|
|
setCookie('van-504-returning-user', true);
|
|
const registrationResult = { redirectUrl: finalRedirectUrl, success };
|
|
return (
|
|
<Redirect to={{
|
|
pathname: AUTHN_PROGRESSIVE_PROFILING,
|
|
state: {
|
|
registrationResult,
|
|
optionalFields,
|
|
},
|
|
}}
|
|
/>
|
|
);
|
|
}
|
|
|
|
// Redirect to Recommendation page
|
|
if (redirectToRecommendationsPage) {
|
|
const registrationResult = { redirectUrl: finalRedirectUrl, success };
|
|
return (
|
|
<Redirect to={{
|
|
pathname: RECOMMENDATIONS,
|
|
state: {
|
|
registrationResult,
|
|
educationLevel,
|
|
userId,
|
|
},
|
|
}}
|
|
/>
|
|
);
|
|
}
|
|
|
|
window.location.href = finalRedirectUrl;
|
|
}
|
|
|
|
return null;
|
|
};
|
|
|
|
RedirectLogistration.defaultProps = {
|
|
educationLevel: null,
|
|
finishAuthUrl: null,
|
|
success: false,
|
|
redirectUrl: '',
|
|
redirectToProgressiveProfilingPage: false,
|
|
optionalFields: {},
|
|
redirectToRecommendationsPage: false,
|
|
userId: null,
|
|
};
|
|
|
|
RedirectLogistration.propTypes = {
|
|
educationLevel: PropTypes.string,
|
|
finishAuthUrl: PropTypes.string,
|
|
success: PropTypes.bool,
|
|
redirectUrl: PropTypes.string,
|
|
redirectToProgressiveProfilingPage: PropTypes.bool,
|
|
optionalFields: PropTypes.shape({}),
|
|
redirectToRecommendationsPage: PropTypes.bool,
|
|
userId: PropTypes.number,
|
|
};
|
|
|
|
export default RedirectLogistration;
|