aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pages/authenticated.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/pages/authenticated.js')
-rw-r--r--ui/app/components/pages/authenticated.js28
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,
}