Skip to content

Commit

Permalink
chore: reverting get smarter learner unenrollment redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sheehan-edx committed Aug 16, 2023
1 parent aa27a03 commit 64b0d2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class BaseCourseCard extends Component {

renderUnenrollModal = () => {
const {
canUnenroll, courseRunId, type, mode,
canUnenroll, courseRunId, type,
} = this.props;
const { modals } = this.state;

Expand All @@ -214,7 +214,6 @@ class BaseCourseCard extends Component {
onSuccess={this.handleUnenrollModalOnSuccess}
isOpen={modals.unenroll.open}
enrollmentType={camelCase(type)}
mode={mode}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { logError } from '@edx/frontend-platform/logging';
import { CourseEnrollmentsContext } from '../../CourseEnrollmentsContextProvider';
import { ToastsContext } from '../../../../../Toasts';
import { unenrollFromCourse } from './data';
import { GETSMARTER_BASE_URL } from '../../data/constants';
import { EXECUTIVE_EDUCATION_COURSE_MODES } from '../../../../../../constants';

const btnLabels = {
default: 'Unenroll',
Expand All @@ -18,7 +16,6 @@ const btnLabels = {

const UnenrollModal = ({
courseRunId,
mode,
enrollmentType,
isOpen,
onClose,
Expand All @@ -38,18 +35,13 @@ const UnenrollModal = ({

const handleUnenrollButtonClick = async () => {
try {
const isExecutiveEducation2UCourse = EXECUTIVE_EDUCATION_COURSE_MODES.includes(mode);
if (isExecutiveEducation2UCourse) {
window.location.href = `${GETSMARTER_BASE_URL}/cancel-defer`;
} else {
setBtnState('pending');
await unenrollFromCourse({
courseId: courseRunId,
});
removeCourseEnrollment({ courseRunId, enrollmentType });
addToast('You have been unenrolled from the course.');
onSuccess();
}
setBtnState('pending');
await unenrollFromCourse({
courseId: courseRunId,
});
removeCourseEnrollment({ courseRunId, enrollmentType });
addToast('You have been unenrolled from the course.');
onSuccess();
} catch (err) {
logError(err);
setError(err);
Expand Down Expand Up @@ -104,11 +96,6 @@ UnenrollModal.propTypes = {
isOpen: PropTypes.bool.isRequired,
onClose: PropTypes.func.isRequired,
onSuccess: PropTypes.func.isRequired,
mode: PropTypes.string,
};

UnenrollModal.defaultProps = {
mode: null,
};

export default UnenrollModal;

0 comments on commit 64b0d2b

Please sign in to comment.