Disable active change switch until interaction completion

This commit is contained in:
Corban-Lee Jones 2024-03-26 16:36:35 +00:00
parent fad9216969
commit 2978f99eeb

View File

@ -299,7 +299,10 @@
// Make the switch toggle the active flag
template.find(".sub-active").prop("checked", data.active).change(function() {
var isChecked = $(this).prop("checked");
var checkbox = $(this);
checkbox.prop("disabled", true);
var isChecked = checkbox.prop("checked");
var activeText = isChecked === true ? "active" : "inactive";
var formData = new FormData();
@ -307,6 +310,7 @@
patchSubscription(data.uuid, formData).then(function(resp) {
showToast("success", "Subscription Modified", `<b>${data.name}</b> is now <b>${activeText}</b>.`);
checkbox.prop("disabled", false);
})
});