Created
July 9, 2018 21:12
-
-
Save BrianJVarley/1dfd30a9c9b51fa58448471888a71d79 to your computer and use it in GitHub Desktop.
service middleware example to set UNit of measure when action dispatched.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function offsetCalculateServiceMiddleware(offsetCalculateService) { | |
return ({ dispatch, getState }) => next => action => { | |
if (action.type == 'CALCULATE') { | |
myService.setUnitOfMeasurement(getState().getIn(['settings']).toJSON()); | |
} | |
return next(action); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment