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();