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/authenticated.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/authenticated.js')
-rw-r--r-- | ui/app/components/pages/authenticated.js | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/ui/app/components/pages/authenticated.js b/ui/app/components/pages/authenticated.js index 89bd238d2..1f6b0be49 100644 --- a/ui/app/components/pages/authenticated.js +++ b/ui/app/components/pages/authenticated.js @@ -5,28 +5,20 @@ const h = require('react-hyperscript') const MetamaskRoute = require('./metamask-route') const { UNLOCK_ROUTE, INITIALIZE_ROUTE } = require('../../routes') -const Authenticated = ({ component: Component, isUnlocked, isInitialized, ...props }) => { - const component = renderProps => { - switch (true) { - case isUnlocked: - return h(Component, { ...renderProps }) - case !isInitialized: - return h(Redirect, { to: { pathname: INITIALIZE_ROUTE } }) - default: - return h(Redirect, { to: { pathname: UNLOCK_ROUTE } }) - } - } +const Authenticated = props => { + const { isUnlocked, isInitialized } = props - return ( - h(MetamaskRoute, { - ...props, - component, - }) - ) + switch (true) { + case isUnlocked && isInitialized: + return h(MetamaskRoute, { ...props }) + case !isInitialized: + return h(Redirect, { to: { pathname: INITIALIZE_ROUTE } }) + default: + return h(Redirect, { to: { pathname: UNLOCK_ROUTE } }) + } } Authenticated.propTypes = { - component: PropTypes.func, isUnlocked: PropTypes.bool, isInitialized: PropTypes.bool, } |