You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
657 B
27 lines
657 B
4 years ago
|
import React, { PureComponent } from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import Loading from '../../components/ui/loading-screen';
|
||
|
import { DEFAULT_ROUTE } from '../../helpers/constants/routes';
|
||
4 years ago
|
|
||
|
export default class Lock extends PureComponent {
|
||
|
static propTypes = {
|
||
|
history: PropTypes.object,
|
||
|
isUnlocked: PropTypes.bool,
|
||
|
lockMetamask: PropTypes.func,
|
||
4 years ago
|
};
|
||
4 years ago
|
|
||
|
componentDidMount() {
|
||
4 years ago
|
const { lockMetamask, isUnlocked, history } = this.props;
|
||
4 years ago
|
|
||
|
if (isUnlocked) {
|
||
4 years ago
|
lockMetamask().then(() => history.push(DEFAULT_ROUTE));
|
||
4 years ago
|
} else {
|
||
4 years ago
|
history.replace(DEFAULT_ROUTE);
|
||
4 years ago
|
}
|
||
|
}
|
||
|
|
||
|
render() {
|
||
4 years ago
|
return <Loading />;
|
||
4 years ago
|
}
|
||
|
}
|