perf: paginate docs list, lazy thumbnails, static cache headers
This commit is contained in:
@@ -206,15 +206,26 @@ async function deleteDoc(docId, btn) {
|
||||
}
|
||||
|
||||
async function unflagDuplicate(docId, btn) {
|
||||
if (!confirm('تأكيد أنها ليست وثيقة مكررة؟')) return;
|
||||
const original = btn.textContent;
|
||||
btn.disabled = true;
|
||||
const res = await fetch(`/documents/${docId}/unflag-duplicate`, { method: 'POST' });
|
||||
if (res.ok) {
|
||||
document.getElementById(`card-${docId}`)?.remove();
|
||||
} else {
|
||||
alert('فشل التحديث.');
|
||||
btn.disabled = false;
|
||||
btn.textContent = '...';
|
||||
try {
|
||||
const res = await fetch(`/documents/${docId}/unflag-duplicate`, {
|
||||
method: 'POST',
|
||||
headers: { 'Accept': 'application/json' },
|
||||
});
|
||||
if (res.ok) {
|
||||
document.getElementById(`card-${docId}`)?.remove();
|
||||
return;
|
||||
}
|
||||
let msg = `HTTP ${res.status}`;
|
||||
try { const j = await res.json(); if (j.error) msg += ` — ${j.error}`; } catch (_) {}
|
||||
alert(`فشل التحديث: ${msg}`);
|
||||
} catch (e) {
|
||||
alert(`خطأ في الشبكة: ${e.message}`);
|
||||
}
|
||||
btn.disabled = false;
|
||||
btn.textContent = original;
|
||||
}
|
||||
|
||||
async function deleteAllDuplicates(btn) {
|
||||
|
||||
Reference in New Issue
Block a user