+
+
Utilisateur non modifié
+
+
+
+
+
Action non autorisée
+
+
+
+
+
+
+
Erreur interne du serveur
+
+
+
+
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");
});
}