diff --git a/web/html/adduser.html b/web/html/adduser.html index 6c04320..36f63e5 100644 --- a/web/html/adduser.html +++ b/web/html/adduser.html @@ -118,6 +118,30 @@
+ + + + + + + + +
diff --git a/web/js/addUser.js b/web/js/addUser.js index 3d6e55e..d22d242 100644 --- a/web/js/addUser.js +++ b/web/js/addUser.js @@ -46,28 +46,35 @@ document.getElementById("addUser").addEventListener("click", function(){ withCredentials: true, data: dataPut }).then(function(response){ + var idAlert = ""; switch(response.status){ - case 200: + case 201: location.reload(); break; case 204: - console.log("Aucun contenu"); - break; - case 401: - console.log("non autorisé"); - break; - case 403: - console.log("interdit"); - break; - case 500: - console.log("erreur interne"); + idAlert="notModified" break; default: - console.log("error inconnue"); + idAlert="unknown"; break } + document.getElementById(idAlert+"Alert").classList.remove("hidden"); }).catch(function(error){ - console.log(error); + switch(error.status){ + case 401: + idAlert="notAuthorized"; + break; + case 403: + idAlert="forbidden"; + break; + case 500: + idAlert="internalServer"; + break; + default: + idAlert="unknown"; + break; + } + document.getElementById(idAlert+"Alert").classList.remove("hidden"); }); }