diff options
Diffstat (limited to 'ui/app/metamask-connect.js')
-rw-r--r-- | ui/app/metamask-connect.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ui/app/metamask-connect.js b/ui/app/metamask-connect.js new file mode 100644 index 000000000..38fc05930 --- /dev/null +++ b/ui/app/metamask-connect.js @@ -0,0 +1,22 @@ +const connect = require('react-redux').connect +const t = require('../i18n-helper').getMessage + +const metamaskConnect = (mapStateToProps, mapDispatchToProps) => { + return connect( + _higherOrderMapStateToProps(mapStateToProps), + mapDispatchToProps + ) +} + +const _higherOrderMapStateToProps = (mapStateToProps) => { + return (state, ownProps = {}) => { + const stateProps = mapStateToProps + ? mapStateToProps(state, ownProps) + : ownProps + console.log(`state.localeMessages`, state.localeMessages); + stateProps.t = t.bind(null, state.localeMessages) + return stateProps + } +} + +module.exports = metamaskConnect
\ No newline at end of file |