You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
680 B
28 lines
680 B
const { connect } = require('react-redux')
|
|
const PropTypes = require('prop-types')
|
|
const { Route } = require('react-router-dom')
|
|
const h = require('react-hyperscript')
|
|
|
|
const MetamaskRoute = ({ component, mascaraComponent, isMascara, ...props }) => {
|
|
return (
|
|
h(Route, {
|
|
...props,
|
|
component: isMascara && mascaraComponent ? mascaraComponent : component,
|
|
})
|
|
)
|
|
}
|
|
|
|
MetamaskRoute.propTypes = {
|
|
component: PropTypes.func,
|
|
mascaraComponent: PropTypes.func,
|
|
isMascara: PropTypes.bool,
|
|
}
|
|
|
|
const mapStateToProps = state => {
|
|
const { metamask: { isMascara } } = state
|
|
return {
|
|
isMascara,
|
|
}
|
|
}
|
|
|
|
module.exports = connect(mapStateToProps)(MetamaskRoute)
|
|
|