From 1367fa334b3aacc74a3ea2ce84572960e5bb7d43 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Fri, 5 Jun 2026 21:27:53 +0000 Subject: [PATCH] Fix credit accounting popup sending to wrong API endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit saveCreditEntry and deleteCreditEntry were using apiFetch() which routes to /api/admin.php, but credits_create/update/delete only exist in /api/platforms.php — causing the Unknown action error on every save. Co-Authored-By: Claude Sonnet 4.6 --- admin/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/index.php b/admin/index.php index f79d34a..5eaf697 100644 --- a/admin/index.php +++ b/admin/index.php @@ -3232,7 +3232,7 @@ async function saveCreditEntry() { const payload = entryId ? {id:parseInt(entryId),credits_purchased:credits,credit_date:date,payment_method:method,notes} : {platform_id:_creditPlatformId,credits_purchased:credits,credit_date:date,payment_method:method,notes}; - const d = await apiFetch(action,'POST',payload); + const d = await fetch(`/api/platforms.php?action=${action}`,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)}).then(r=>r.json()); if (d.success) { showAdminAlert(al, entryId ? 'Entry updated!' : 'Entry added!', 'success'); resetCreditForm(); @@ -3244,7 +3244,7 @@ async function saveCreditEntry() { async function deleteCreditEntry(id) { if (!confirm('Delete this credit entry? This cannot be undone.')) return; - const d = await apiFetch('credits_delete','POST',{id}); + const d = await fetch('/api/platforms.php?action=credits_delete',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({id})}).then(r=>r.json()); if (d.success) { toast('Entry deleted','ok'); await loadCreditEntries(); } else toast(d.error||'Error','err'); }