2018-03-16 01:29:45 +01:00
|
|
|
const connect = require('react-redux').connect
|
2018-03-22 01:41:47 +01:00
|
|
|
const t = require('../i18n-helper').getMessage
|
2018-03-16 01:29:45 +01:00
|
|
|
|
|
|
|
const metamaskConnect = (mapStateToProps, mapDispatchToProps) => {
|
|
|
|
return connect(
|
|
|
|
_higherOrderMapStateToProps(mapStateToProps),
|
|
|
|
mapDispatchToProps
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const _higherOrderMapStateToProps = (mapStateToProps) => {
|
2018-03-19 19:53:54 +01:00
|
|
|
return (state, ownProps = {}) => {
|
|
|
|
const stateProps = mapStateToProps
|
|
|
|
? mapStateToProps(state, ownProps)
|
|
|
|
: ownProps
|
2018-03-22 01:41:47 +01:00
|
|
|
console.log(`state.localeMessages`, state.localeMessages);
|
|
|
|
stateProps.t = t.bind(null, state.localeMessages)
|
2018-03-16 01:29:45 +01:00
|
|
|
return stateProps
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = metamaskConnect
|