mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 18:41:38 +01:00
26 lines
670 B
JavaScript
26 lines
670 B
JavaScript
const { connect } = require('react-redux')
|
|
const PropTypes = require('prop-types')
|
|
const { Redirect } = require('react-router-dom')
|
|
const h = require('react-hyperscript')
|
|
const { INITIALIZE_ROUTE } = require('../../routes')
|
|
const MetamaskRoute = require('./metamask-route')
|
|
|
|
const Initialized = props => {
|
|
return props.isInitialized
|
|
? h(MetamaskRoute, { ...props })
|
|
: h(Redirect, { to: { pathname: INITIALIZE_ROUTE } })
|
|
}
|
|
|
|
Initialized.propTypes = {
|
|
isInitialized: PropTypes.bool,
|
|
}
|
|
|
|
const mapStateToProps = state => {
|
|
const { metamask: { isInitialized } } = state
|
|
return {
|
|
isInitialized,
|
|
}
|
|
}
|
|
|
|
module.exports = connect(mapStateToProps)(Initialized)
|