to redirect to the current unit’s lmsWebUrl if the MFE is disabled If we receive an error_code of 'microfrontend_disabled', go to the equivalent unit in the LMS experience. Fixes: TNL-7362 Co-authored-by: stvn <stvn@mit.edu>
15 lines
424 B
JavaScript
15 lines
424 B
JavaScript
import { getConfig } from '@edx/frontend-platform';
|
|
|
|
import { useModel } from '../generic/model-store';
|
|
|
|
export default function CourseRedirect({ match }) {
|
|
const {
|
|
courseId,
|
|
unitId,
|
|
} = match.params;
|
|
const unit = useModel('units', unitId) || {};
|
|
const coursewareUrl = unit.lmsWebUrl || `${getConfig().LMS_BASE_URL}/courses/${courseId}/courseware/`;
|
|
global.location.assign(coursewareUrl);
|
|
return null;
|
|
}
|