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 () => {
|
onClick={async () => {
|
||||||
setActionLoading(`${student.id}_${course.id}`);
|
setActionLoading(`${student.id}_${course.id}`);
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`/api/admin/students/${student.id}/courses/${course.id}`, {
|
const res = await fetch(`/api/admin/students/${student.id}/unlock-course`, {
|
||||||
method: isUnlocked ? 'DELETE' : 'POST',
|
method: 'POST',
|
||||||
headers: { 'Authorization': `Bearer ${token}` }
|
headers: {
|
||||||
|
'Authorization': `Bearer ${token}`,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
courseId: course.id,
|
||||||
|
unlocked: !isUnlocked
|
||||||
|
})
|
||||||
});
|
});
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
fetchStudents();
|
fetchStudents();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue