clean up deleted q

This commit is contained in:
x
2026-01-24 00:14:25 +01:00
parent 1a3514effa
commit 85578b179b
3 changed files with 202 additions and 69 deletions

View File

@@ -206,16 +206,22 @@
confirmBtn.onclick = async () => {
confirmBtn.textContent = 'Deleting...';
confirmBtn.disabled = true;
const res = await post("/api/v2/admin/deletepost", {
postid: postid
});
if (!res.success) {
alert(res.msg);
try {
const res = await post("/api/v2/admin/deletepost", {
postid: postid
});
if (!res.success) {
alert(res.msg);
confirmBtn.textContent = 'Delete';
confirmBtn.disabled = false;
} else {
closeModal();
window.location.href = '/';
}
} catch (e) {
alert('Error: ' + e); // Or e.message
confirmBtn.textContent = 'Delete';
confirmBtn.disabled = false;
} else {
closeModal();
window.location.href = '/';
}
};
}