summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/extensions/blocks/publicize/store/middlewares.js')
-rw-r--r--plugins/jetpack/extensions/blocks/publicize/store/middlewares.js40
1 files changed, 0 insertions, 40 deletions
diff --git a/plugins/jetpack/extensions/blocks/publicize/store/middlewares.js b/plugins/jetpack/extensions/blocks/publicize/store/middlewares.js
deleted file mode 100644
index 1403b808..00000000
--- a/plugins/jetpack/extensions/blocks/publicize/store/middlewares.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * External dependencies
- */
-import refx from 'refx';
-import { flowRight } from 'lodash';
-
-/**
- * Internal dependencies
- */
-import effects from './effects';
-
-/**
- * Applies the custom middlewares used specifically in the Publicize extension.
- *
- * @param {Object} store Store Object.
- *
- * @return {Object} Update Store Object.
- */
-export default function applyMiddlewares( store ) {
- const middlewares = [ refx( effects ) ];
-
- let enhancedDispatch = () => {
- throw new Error(
- 'Dispatching while constructing your middleware is not allowed. ' +
- 'Other middleware would not be applied to this dispatch.'
- );
- };
- let chain = [];
-
- const middlewareAPI = {
- getState: store.getState,
- dispatch: ( ...args ) => enhancedDispatch( ...args ),
- };
- chain = middlewares.map( middleware => middleware( middlewareAPI ) );
- enhancedDispatch = flowRight( ...chain )( store.dispatch );
-
- store.dispatch = enhancedDispatch;
-
- return store;
-}