clean up deleted q
This commit is contained in:
@@ -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 = '/';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user