Reset app state without closing/restarting it

This commit is contained in:
Sofiya Tepikin
2022-08-10 15:40:48 +02:00
parent 0ec23219bf
commit 08b0dc7734
8 changed files with 51 additions and 21 deletions
+3 -8
View File
@@ -4,13 +4,12 @@ import PropTypes from 'prop-types'
import Button from '../../common/button'
import ConfirmWithPassword from '../common/confirm-with-password'
import { changeEncryptionAndRestartApp } from '../../../db'
import labels from '../../../i18n/en/settings'
export default class DeletePassword extends Component {
static propTypes = {
onStartDelete: PropTypes.func,
onCancelDelete: PropTypes.func
onCancelDelete: PropTypes.func,
}
constructor() {
@@ -24,10 +23,6 @@ export default class DeletePassword extends Component {
this.props.onStartDelete()
}
startDeletePassword = async () => {
await changeEncryptionAndRestartApp()
}
cancelConfirmationWithPassword = () => {
this.setState({ enteringCurrentPassword: false })
this.props.onCancelDelete()
@@ -39,7 +34,7 @@ export default class DeletePassword extends Component {
if (enteringCurrentPassword) {
return (
<ConfirmWithPassword
onSuccess={this.startDeletePassword}
onSuccess={this.props.changeEncryptionAndRestart}
onCancel={this.cancelConfirmationWithPassword}
/>
)
@@ -51,4 +46,4 @@ export default class DeletePassword extends Component {
</Button>
)
}
}
}