// @flow import React from 'react'; import { FormRow, FormField } from 'component/common/form'; import { Modal } from 'modal/modal'; import Button from 'component/button'; type Props = { closeModal: () => void, unlockWallet: string => void, walletDecryptSucceded: boolean, updateWalletStatus: boolean, }; class ModalWalletDecrypt extends React.PureComponent { state = { submitted: false, // Prior actions could be marked complete }; submitDecryptForm() { this.setState({ submitted: true }); this.props.decryptWallet(); } componentDidUpdate() { const { props, state } = this; if (state.submitted && props.walletDecryptSucceded === true) { props.closeModal(); props.updateWalletStatus(); } } render() { const { closeModal, walletDecryptSucceded } = this.props; return ( this.submitDecryptForm()} onAborted={closeModal} > {__( 'Your wallet has been encrypted with a local password, performing this action will remove this password.' )}