async function resetStudent(id, name) { if (!confirm('Resetar TODOS os dados de ' + name + '? (tarefas, gravações, notas)\nEsta ação não pode ser desfeita!')) return; try { const r = await fetch('/api/users/reset/' + id, { method: 'POST', headers: { Authorization: 'Bearer ' + localStorage.getItem('ep_token') } }); const d = await r.json(); if (d.error) throw new Error(d.error); alert('Dados de ' + name + ' resetados!'); loadStudents(); } catch (e) { alert('Erro: ' + e.message); } } async function deleteStudent(id, name) { if (!confirm('DELETAR o aluno ' + name + ' permanentemente?\nTodos os dados serão perdidos!')) return; if (!confirm('Tem certeza? Esta ação é IRREVERSÍVEL!')) return; try { const r = await fetch('/api/users/' + id, { method: 'DELETE', headers: { Authorization: 'Bearer ' + localStorage.getItem('ep_token') } }); const d = await r.json(); if (d.error) throw new Error(d.error); alert('Aluno ' + name + ' deletado!'); loadStudents(); } catch (e) { alert('Erro: ' + e.message); } }