1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 13:10:24 +02:00

Add error handling to edit group modal

This commit is contained in:
Toby Zerner
2015-10-19 15:44:00 +10:30
parent ed4be20be2
commit a74c4ebd71

View File

@@ -65,7 +65,7 @@ export default class EditGroupModal extends Modal {
children: app.trans('core.admin.edit_group_submit_button') children: app.trans('core.admin.edit_group_submit_button')
})} })}
{this.group.exists && this.group.id() !== Group.ADMINISTRATOR_ID ? ( {this.group.exists && this.group.id() !== Group.ADMINISTRATOR_ID ? (
<button type="button" className="Button EditGroupModal-delete" onclick={this.delete.bind(this)}> <button type="button" className="Button EditGroupModal-delete" onclick={this.deleteGroup.bind(this)}>
{app.trans('core.admin.edit_group_delete_button')} {app.trans('core.admin.edit_group_delete_button')}
</button> </button>
) : ''} ) : ''}
@@ -87,14 +87,14 @@ export default class EditGroupModal extends Modal {
icon: this.icon() icon: this.icon()
}).then( }).then(
() => this.hide(), () => this.hide(),
() => { (response) => {
this.loading = false; this.loading = false;
m.redraw(); this.handleErrors(response);
} }
); );
} }
delete() { deleteGroup() {
if (confirm(app.trans('core.admin.edit_group_delete_confirmation'))) { if (confirm(app.trans('core.admin.edit_group_delete_confirmation'))) {
this.group.delete().then(() => m.redraw()); this.group.delete().then(() => m.redraw());
this.hide(); this.hide();