diff options
author | Alexander Tseung <alextsg@gmail.com> | 2017-12-05 04:13:02 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2017-12-15 06:11:23 +0800 |
commit | 706a6b0ad6d7b6e2d56252f17713e63430d84abc (patch) | |
tree | f956746763dfe4d09388d261698edde88fea933e /ui/app/components/pages/initialized.js | |
parent | d9ea2df6c2a2cabedead09f90c3c9bb7b4c37dd1 (diff) | |
download | tangerine-wallet-browser-706a6b0ad6d7b6e2d56252f17713e63430d84abc.tar tangerine-wallet-browser-706a6b0ad6d7b6e2d56252f17713e63430d84abc.tar.gz tangerine-wallet-browser-706a6b0ad6d7b6e2d56252f17713e63430d84abc.tar.bz2 tangerine-wallet-browser-706a6b0ad6d7b6e2d56252f17713e63430d84abc.tar.lz tangerine-wallet-browser-706a6b0ad6d7b6e2d56252f17713e63430d84abc.tar.xz tangerine-wallet-browser-706a6b0ad6d7b6e2d56252f17713e63430d84abc.tar.zst tangerine-wallet-browser-706a6b0ad6d7b6e2d56252f17713e63430d84abc.zip |
Add initialized checks for first time flow routes
Diffstat (limited to 'ui/app/components/pages/initialized.js')
-rw-r--r-- | ui/app/components/pages/initialized.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ui/app/components/pages/initialized.js b/ui/app/components/pages/initialized.js new file mode 100644 index 000000000..3adf67b28 --- /dev/null +++ b/ui/app/components/pages/initialized.js @@ -0,0 +1,25 @@ +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) |