From 9c5143bea6364f66696e135bcb1d8e37487ea614 Mon Sep 17 00:00:00 2001 From: Sidney Gomes Date: Sat, 25 Jul 2026 19:31:04 -0300 Subject: [PATCH] =?UTF-8?q?Corrigido=20endpoint=20de=20libera=C3=A7=C3=A3o?= =?UTF-8?q?=20e=20bloqueio=20manual=20de=20cursos=20no=20painel=20Admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AdminDashboard.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/AdminDashboard.tsx b/src/components/AdminDashboard.tsx index 177ed16..ef3e2ab 100644 --- a/src/components/AdminDashboard.tsx +++ b/src/components/AdminDashboard.tsx @@ -761,9 +761,16 @@ export default function AdminDashboard({ token, adminUser, onLogout }: AdminDash onClick={async () => { setActionLoading(`${student.id}_${course.id}`); try { - const res = await fetch(`/api/admin/students/${student.id}/courses/${course.id}`, { - method: isUnlocked ? 'DELETE' : 'POST', - headers: { 'Authorization': `Bearer ${token}` } + const res = await fetch(`/api/admin/students/${student.id}/unlock-course`, { + method: 'POST', + headers: { + 'Authorization': `Bearer ${token}`, + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + courseId: course.id, + unlocked: !isUnlocked + }) }); if (res.ok) { fetchStudents();