Restore the previous status when an application status change is refused

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-30 15:44:32 +02:00
1 parent 0e268f3f3c
commit d100ab21ef
1 file changed
+3 -2
+3 -2
View File
@@ -59,7 +59,7 @@
const company = companies.get(application.company_key);
cell(tr, "Company", company ? company.name : application.company_key);
const select = statusSelect(application.status);
select.addEventListener("change", () => setStatus(application.id, select));
select.addEventListener("change", () => setStatus(application.id, select, application.status));
cell(tr, "Status", select);
const saved = cell(tr, "Saved", savedOn(application.created_at));
saved.title = application.created_at;
@@ -69,7 +69,7 @@
count(applications.length, "tracked application");
}
async function setStatus(id, select) {
async function setStatus(id, select, was) {
select.disabled = true;
try {
await api(`/api/applications/${encodeURIComponent(id)}/status`, {
@@ -77,6 +77,7 @@
});
render(await api("/api/applications"));
} catch (err) {
select.value = was; // the change was refused, so the row still holds `was`
select.disabled = false;
}
}