Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save BrianJVarley/1dfd30a9c9b51fa58448471888a71d79 to your computer and use it in GitHub Desktop.
Save BrianJVarley/1dfd30a9c9b51fa58448471888a71d79 to your computer and use it in GitHub Desktop.
service middleware example to set UNit of measure when action dispatched.
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