Created
February 15, 2017 20:53
-
-
Save johnhunter/d4fa3dc345da47dcdd3bc053f71d72ed to your computer and use it in GitHub Desktop.
transformation from https://github.com/johnhunter/react-voting-client/blob/master/src/remote_action_middleware.js#L3
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
exports.default = function (socket) { | |
return function (store) { | |
return function (next) { | |
return function (action) { | |
if (action.meta && action.meta.remote) { | |
var clientId = store.getState().get('clientId'); | |
socket.emit('action', objectAssign({}, action, { clientId: clientId })); | |
} | |
return next(action); | |
}; | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment