chore: remove reloadSubmissions key from request and use initialize to reloadSubmissions table (#65)
Co-authored-by: Justin Lapierre <jlapierre@edx.org>
This commit is contained in:
@@ -37,7 +37,7 @@ jest.mock('data/redux', () => ({
|
||||
},
|
||||
thunkActions: {
|
||||
app: {
|
||||
reloadSubmissions: jest.fn(),
|
||||
initialize: jest.fn(),
|
||||
},
|
||||
grading: {
|
||||
cancelGrading: jest.fn(),
|
||||
@@ -176,8 +176,8 @@ describe('ReviewModal component', () => {
|
||||
expect(mapDispatchToProps.setShowReview).toEqual(actions.app.setShowReview);
|
||||
});
|
||||
|
||||
it('loads reloadSubmissions from thunkActions.app.reloadSubmissions', () => {
|
||||
expect(mapDispatchToProps.reloadSubmissions).toEqual(thunkActions.app.reloadSubmissions);
|
||||
it('loads reloadSubmissions from thunkActions.app.initialize', () => {
|
||||
expect(mapDispatchToProps.reloadSubmissions).toEqual(thunkActions.app.initialize);
|
||||
});
|
||||
|
||||
it('loads stopGrading from thunkActions.grading.cancelGrading', () => {
|
||||
|
||||
@@ -9,7 +9,6 @@ export const RequestStates = StrictDict({
|
||||
|
||||
export const RequestKeys = StrictDict({
|
||||
initialize: 'initialize',
|
||||
reloadSubmissions: 'reloadSubmissions',
|
||||
fetchSubmission: 'fetchSubmission',
|
||||
fetchSubmissionStatus: 'fetchSubmissionStatus',
|
||||
setLock: 'setLock',
|
||||
|
||||
@@ -19,18 +19,4 @@ export const initialize = () => (dispatch) => {
|
||||
}));
|
||||
};
|
||||
|
||||
/**
|
||||
* initialize the app, loading ora and course metadata from the api, and loading the initial
|
||||
* submission list data.
|
||||
*/
|
||||
export const reloadSubmissions = () => (dispatch) => {
|
||||
dispatch(initializeApp({
|
||||
locationId,
|
||||
reload: true,
|
||||
onSuccess: (response) => {
|
||||
dispatch(actions.submissions.loadList(response.submissions));
|
||||
},
|
||||
}));
|
||||
};
|
||||
|
||||
export default StrictDict({ initialize, reloadSubmissions });
|
||||
export default StrictDict({ initialize });
|
||||
|
||||
@@ -35,15 +35,14 @@ export const networkRequest = ({
|
||||
|
||||
/**
|
||||
* Tracked initializeApp api method.
|
||||
* Tracked to the `initialize` or `reloadSubmissions` request key.
|
||||
* Tracked to the `initialize` request key.
|
||||
* @param {string} locationId - ora location id
|
||||
* @param {bool} reload - is reloading submission
|
||||
* @param {[func]} onSuccess - onSuccess method ((response) => { ... })
|
||||
* @param {[func]} onFailure - onFailure method ((error) => { ... })
|
||||
*/
|
||||
export const initializeApp = ({ locationId, reload, ...rest }) => (dispatch) => {
|
||||
export const initializeApp = ({ locationId, ...rest }) => (dispatch) => {
|
||||
dispatch(module.networkRequest({
|
||||
requestKey: reload ? RequestKeys.reloadSubmissions : RequestKeys.initialize,
|
||||
requestKey: RequestKeys.initialize,
|
||||
promise: api.initializeApp(locationId),
|
||||
...rest,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user