diff --git a/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js b/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js index a828bbe4d33..382cee16de8 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js @@ -248,8 +248,13 @@ export default class AdminBadgesShowController extends Controller.extend( @action toggleBadge() { - this.model - .save({ enabled: !this.buffered.get("enabled") }) - .catch(popupAjaxError); + const originalState = this.buffered.get("enabled"); + const newState = !this.buffered.get("enabled"); + + this.buffered.set("enabled", newState); + this.model.save({ enabled: newState }).catch((error) => { + this.buffered.set("enabled", originalState); + return popupAjaxError(error); + }); } }