Skip to content

Commit a96653f

Browse files
fix: unenroll user from course if show survey is false
1 parent 2d698d8 commit a96653f

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ CAREER_LINK_URL=''
4242
ENABLE_EDX_PERSONAL_DASHBOARD=false
4343
ENABLE_PROGRAMS=false
4444
NON_BROWSABLE_COURSES=false
45-
SHOW_UNENROLL_SURVEY=false
45+
SHOW_UNENROLL_SURVEY=true
4646
# Fallback in local style files
4747
PARAGON_THEME_URLS={}

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ CAREER_LINK_URL=''
4848
ENABLE_EDX_PERSONAL_DASHBOARD=false
4949
ENABLE_PROGRAMS=false
5050
NON_BROWSABLE_COURSES=false
51-
SHOW_UNENROLL_SURVEY=false
51+
SHOW_UNENROLL_SURVEY=true
5252
# Fallback in local style files
5353
PARAGON_THEME_URLS={}

src/containers/UnenrollConfirmModal/hooks/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ export const modalStates = StrictDict({
2121

2222
export const useUnenrollData = ({ closeModal, cardId }) => {
2323
const [isConfirmed, setIsConfirmed] = module.state.confirmed(false);
24-
const confirm = () => setIsConfirmed(true);
2524
const reason = useUnenrollReasons({ cardId });
2625
const refreshList = apiHooks.useInitializeApp();
2726

27+
const unenrollFromCourse = apiHooks.useUnenrollFromCourse(cardId);
28+
29+
const confirm = () => {
30+
if (!configuration.SHOW_UNENROLL_SURVEY) {
31+
unenrollFromCourse();
32+
}
33+
setIsConfirmed(true);
34+
};
35+
2836
let modalState;
2937
if (isConfirmed) {
3038
modalState = (reason.isSubmitted || !configuration.SHOW_UNENROLL_SURVEY)

webpack.dev-tutor.config.js

Whitespace-only changes.

0 commit comments

Comments
 (0)