From 09f436e998950b152209280a179b341bbadd25e2 Mon Sep 17 00:00:00 2001 From: elouanjef Date: Sat, 27 Jan 2024 15:14:50 +0100 Subject: [PATCH] deleteuser admin --- templates/admin.html | 19 +++++++++++++++++++ templates/professor.html | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/templates/admin.html b/templates/admin.html index d612cf2..8f222c8 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -299,6 +299,25 @@

Templates de VMs

} }); } + + function deleteUser(userId) { + $.ajax({ + type: 'DELETE', + url: 'https://api.insa-cvl.com/deleteuser', + contentType: 'application/json;charset=UTF-8', + data: JSON.stringify({ user_id: userId }), + xhrFields: { + withCredentials: true + }, + success: function (response) { + alert('Utilisateur supprimé avec succès!'); + location.reload(); + }, + error: function (error) { + alert('Erreur lors de la suppression de l\'utilisateur.'); + } + }); + } function addTemplateToDOM(template) { var templateCard = createTemplateCard(template); diff --git a/templates/professor.html b/templates/professor.html index 2a0853b..07c8f41 100644 --- a/templates/professor.html +++ b/templates/professor.html @@ -334,7 +334,7 @@ $('#addVMOutCard').on('click', function () { $("#createVmModal").modal("show"); }); - $('#addUserCard').on('click', function () { + $('#addUserButton').on('click', function () { $("#createUserModal").modal("show"); }); });