mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 12:56:01 +01:00
76a2a9bb8b
* @metamask/eslint-config@5.0.0 * Update eslintrc and prettierrc * yarn lint:fix
27 lines
657 B
JavaScript
27 lines
657 B
JavaScript
import React, { PureComponent } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import Loading from '../../components/ui/loading-screen';
|
|
import { DEFAULT_ROUTE } from '../../helpers/constants/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 />;
|
|
}
|
|
}
|