Skip to content

Commit

Permalink
use full store
Browse files Browse the repository at this point in the history
  • Loading branch information
pofigizm committed Aug 28, 2018
1 parent 0c0758b commit 3cd7e12
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-dynamic-middlewares",
"version": "0.4.0",
"version": "0.5.0",
"description": "Allow add or remove redux middlewares dynamically",
"main": "lib/index.js",
"scripts": {
Expand Down
9 changes: 2 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import { compose } from 'redux'

let allDynamicMiddlewares = []

const dynamicMiddlewares = ({ getState, dispatch }) => next => (action) => {
const middlewareAPI = {
getState,
dispatch: act => dispatch(act),
}

const chain = allDynamicMiddlewares.map(middleware => middleware(middlewareAPI))
const dynamicMiddlewares = store => next => (action) => {
const chain = allDynamicMiddlewares.map(middleware => middleware(store))

return compose(...chain)(next)(action)
}
Expand Down

0 comments on commit 3cd7e12

Please sign in to comment.