PR grumbles, wording, isRequired, no close on error

This commit is contained in:
Jaco Greeff 2016-11-23 22:17:36 +01:00
parent 6c686023e0
commit 97ec5053f0

View File

@ -31,8 +31,8 @@ class DeleteAccount extends Component {
static propTypes = { static propTypes = {
account: PropTypes.object.isRequired, account: PropTypes.object.isRequired,
onClose: PropTypes.func, onClose: PropTypes.func.isRequired,
newError: PropTypes.func newError: PropTypes.func.isRequired
} }
state = { state = {
@ -51,7 +51,7 @@ class DeleteAccount extends Component {
onDeny={ this.closeDeleteDialog } onDeny={ this.closeDeleteDialog }
onConfirm={ this.onDeleteConfirmed }> onConfirm={ this.onDeleteConfirmed }>
<div className={ styles.hero }> <div className={ styles.hero }>
Are you sure you want to remove permanently delete the following account? Are you sure you want to permanently delete the following account?
</div> </div>
<div className={ styles.info }> <div className={ styles.info }>
<IdentityIcon <IdentityIcon
@ -95,16 +95,14 @@ class DeleteAccount extends Component {
.then((result) => { .then((result) => {
if (result === true) { if (result === true) {
router.push('/accounts'); router.push('/accounts');
this.closeDeleteDialog();
} else { } else {
newError(new Error('Deletion failed.')); newError(new Error('Deletion failed.'));
} }
this.closeDeleteDialog();
}) })
.catch((error) => { .catch((error) => {
console.error('onDeleteConfirmed', error); console.error('onDeleteConfirmed', error);
newError(new Error(`Deletion failed: ${error.message}`)); newError(new Error(`Deletion failed: ${error.message}`));
this.closeDeleteDialog();
}); });
} }