PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / trunk
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses vtrunk
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / assets / src / apps / js / frontend / modal / store / middlewares.js

middlewares.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses trunk, at assets/src/apps/js/frontend/modal/store/middlewares.js

43 lines 891 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * External dependencies
3 */
4 import refx from 'refx';
5
6 const effects = {
7 ENROLL_COURSE_X: ( action, store ) => {
8 enrollCourse: ( action, store ) => {
9 const { dispatch } = store;
10
11 //dispatch()
12 };
13 },
14 };
15
16 /**
17 * Applies the custom middlewares used specifically in the editor module.
18 *
19 * @param {Object} store Store Object.
20 *
21 * @return {Object} Update Store Object.
22 */
23 function applyMiddlewares( store ) {
24 let enhancedDispatch = () => {
25 throw new Error(
26 'Dispatching while constructing your middleware is not allowed. ' +
27 'Other middleware would not be applied to this dispatch.'
28 );
29 };
30
31 const middlewareAPI = {
32 getState: store.getState,
33 dispatch: ( ...args ) => enhancedDispatch( ...args ),
34 };
35
36 enhancedDispatch = refx( effects )( middlewareAPI )( store.dispatch );
37
38 store.dispatch = enhancedDispatch;
39 return store;
40 }
41
42 export default applyMiddlewares;
43