diff --git a/admin/index.php b/admin/index.php index 50dfed3..66ea8c2 100644 --- a/admin/index.php +++ b/admin/index.php @@ -2480,6 +2480,7 @@ async function submitPayout(){ // ─── REFERRAL MANAGEMENT ────────────────────────────────── let _refTiers = []; +let _refListReqId = 0; function showRefSection(section) { document.getElementById('ref-admin-list').style.display = section==='list'?'block':'none'; @@ -2490,6 +2491,7 @@ function showRefSection(section) { } async function loadAdminReferrals(status, btn) { + const reqId = ++_refListReqId; document.getElementById('ref-admin-list').style.display='block'; document.getElementById('ref-tiers-section').style.display='none'; document.getElementById('ref-shares-section').style.display='none'; @@ -2497,6 +2499,7 @@ async function loadAdminReferrals(status, btn) { const el = document.getElementById('ref-admin-list'); el.innerHTML = '
Loading...
'; const d = await fetch('/api/referrals.php?action=admin_list&status='+status).then(r=>r.json()); + if (reqId !== _refListReqId) return; // discard stale response if (!d.success||!d.referrals.length) { el.innerHTML='
No '+status+' referrals.
'; return; } el.innerHTML = d.referrals.map(r => buildRefCard(r, status)).join(''); } @@ -2525,7 +2528,9 @@ async function resolveReferral(id, status) { }).then(r=>r.json()); if (d.success) { toast(status==='verified' ? 'Verified! '+d.tokens_awarded+' tokens awarded' : 'Denied', status==='verified'?'ok':'err'); - loadAdminReferrals('pending', document.querySelector('#section-referrals .ftab')); + // Reload the pending tab (items resolved out of pending); active tab indicator stays correct + const pendingBtn = document.querySelector('#section-referrals .ftab'); + loadAdminReferrals('pending', pendingBtn); loadStats(); } else toast(d.error||'Error','err'); }