Update DOM after creating, updating or deleting a rule.

This commit is contained in:
root
2024-02-21 02:48:50 -05:00
parent 065cd6dec9
commit c3bc4d2fcd

View File

@@ -93,7 +93,10 @@ AutoRunTab = function() {
const res = await fetch(`/api/autorun/rule/${id}?token=${token}`, {method: 'DELETE'});
if (!res.ok) {
console.error(`Failed when deleting rule with id ${id}. Failed with status ${res.status}.`);
return;
}
// Update the entire rules panel. Not very efficient.
loadRules();
}
async function addRule() {
@@ -104,7 +107,10 @@ AutoRunTab = function() {
});
if (!res.ok) {
console.error(`Failed when adding a new rule with status ${res.status}.`);
return;
}
// Update the entire rules panel. Not very efficient.
loadRules();
}
async function updateRule(id, newRuleData) {
@@ -115,7 +121,10 @@ AutoRunTab = function() {
});
if (!res.ok) {
console.error(`Failed when adding a new rule with status ${res.status}.`);
return;
}
// Update the entire rules panel. Not very efficient.
loadRules();
}
async function loadRules() {