fix: select session workflow (#59)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user