aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pages/lock/lock.component.js
blob: 51f8742edf642f42a177e0222fd88923a5811968 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import Loading from '../../loading-screen'
import { DEFAULT_ROUTE } from '../../../routes'

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 />
  }
}