Corrigido endpoint de liberação e bloqueio manual de cursos no painel Admin
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 59s
Details
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 59s
Details
This commit is contained in:
parent
3708444f51
commit
9c5143bea6
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue