2019-01-23 16:25:34 +01:00
|
|
|
import React, { PureComponent } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
2019-03-22 00:03:30 +01:00
|
|
|
import Loading from '../../components/ui/loading-screen'
|
|
|
|
import { DEFAULT_ROUTE } from '../../helpers/constants/routes'
|
2019-01-23 16:25:34 +01:00
|
|
|
|
|
|
|
export default class Lock extends PureComponent {
|
|
|
|
static propTypes = {
|
|
|
|
history: PropTypes.object,
|
|
|
|
isUnlocked: PropTypes.bool,
|
|
|
|
lockMetamask: PropTypes.func,
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount () {
|
|
|
|
const { lockMetamask, isUnlocked, history } = this.props
|
|
|
|
|
|
|
|
if (isUnlocked) {
|
|
|
|
lockMetamask().then(() => history.push(DEFAULT_ROUTE))
|
|
|
|
} else {
|
|
|
|
history.replace(DEFAULT_ROUTE)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return <Loading />
|
|
|
|
}
|
|
|
|
}
|