fix: select session workflow (#59)

This commit is contained in:
Ben Warzeski
2022-11-01 14:14:07 -04:00
committed by GitHub
parent 0badf690a6
commit c8b729a65d
10 changed files with 106 additions and 87 deletions

View File

@@ -1,4 +1,4 @@
import { useSelector } from 'react-redux';
import { useSelector, useDispatch } from 'react-redux';
import { actions as appActions } from './app/reducer';
import appSelectors from './app/selectors';
@@ -58,9 +58,10 @@ export const useCardSocialSettingsData = (cardId) => {
};
};
export const useUpdateSelectSessionModalCallback = (dispatch, cardId) => () => dispatch(
appActions.updateSelectSessionModal(cardId),
);
export const useUpdateSelectSessionModalCallback = (cardId) => {
const dispatch = useDispatch();
return () => dispatch(appActions.updateSelectSessionModal(cardId));
};
export const useMasqueradeData = () => useSelector(requestSelectors.masquerade);

View File

@@ -38,7 +38,8 @@ export const newEntitlementEnrollment = (cardId, selection) => (dispatch, getSta
fromCourseRun: null,
toCourseRun: selection,
});
return dispatch(requests.newEntitlementEnrollment({ uuid, courseId: selection }));
dispatch(requests.newEntitlementEnrollment({ uuid, courseId: selection }));
dispatch(initialize());
};
export const switchEntitlementEnrollment = (cardId, selection) => (dispatch, getState) => {
@@ -48,7 +49,8 @@ export const switchEntitlementEnrollment = (cardId, selection) => (dispatch, get
fromCourseRun: courseId,
toCourseRun: selection,
});
return dispatch(requests.switchEntitlementEnrollment({ uuid, courseId: selection }));
dispatch(requests.switchEntitlementEnrollment({ uuid, courseId: selection }));
dispatch(initialize());
};
export const leaveEntitlementSession = (cardId) => (dispatch, getState) => {
@@ -58,7 +60,8 @@ export const leaveEntitlementSession = (cardId) => (dispatch, getState) => {
fromCourseRun: courseId,
toCourseRun: null,
});
return dispatch(requests.leaveEntitlementSession({ uuid }));
dispatch(requests.leaveEntitlementSession({ uuid }));
dispatch(initialize());
};
export const unenrollFromCourse = (cardId, reason) => (dispatch, getState) => {