Files
frontend-app-authn/src/common-components/RedirectLogistration.jsx
Waheed Ahmed 91975350f0 Redirect to dashboard if user already logged in.
Did some refactoring for common components, also fixed soe test warnings.

VAN-131
2020-11-30 14:30:08 +05:00

35 lines
859 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { getConfig } from '@edx/frontend-platform';
function RedirectLogistration(props) {
const { finishAuthUrl, success, redirectUrl } = props;
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.
if (finishAuthUrl) {
window.location.href = getConfig().LMS_BASE_URL + finishAuthUrl;
} else {
window.location.href = redirectUrl;
}
}
return <></>;
}
RedirectLogistration.defaultProps = {
finishAuthUrl: null,
success: false,
redirectUrl: '',
};
RedirectLogistration.propTypes = {
finishAuthUrl: PropTypes.string,
success: PropTypes.bool,
redirectUrl: PropTypes.string,
};
export default RedirectLogistration;