Extract real method

Refs #1750, #1788.
This commit is contained in:
Franz Liedke 2019-08-14 08:27:06 +02:00
parent c3740281b6
commit e7cdd497dd

View File

@ -100,7 +100,17 @@ export default {
return; return;
} }
const showAlert = type => { this.delete().then(() => {
this.showDeletionAlert('success');
if (app.current instanceof UserPage && app.current.user === this) {
app.history.back();
} else {
window.location.reload();
}
}).catch(() => this.showDeletionAlert('error'));
},
showDeletionAlert(type) {
const { username, email } = this.data.attributes; const { username, email } = this.data.attributes;
app.alerts.show(new Alert({ app.alerts.show(new Alert({
@ -109,16 +119,6 @@ export default {
`core.forum.user.delete_alert_${type}`, { username, email } `core.forum.user.delete_alert_${type}`, { username, email }
) )
})); }));
};
this.delete().then(() => {
showAlert('success');
if (app.current instanceof UserPage && app.current.user === this) {
app.history.back();
} else {
window.location.reload();
}
}).catch(() => showAlert('error'));
}, },
/** /**