diff --git a/web/html/home.html b/web/html/user.html similarity index 56% rename from web/html/home.html rename to web/html/user.html index f61c705..e7176f0 100644 --- a/web/html/home.html +++ b/web/html/user.html @@ -87,14 +87,13 @@ @@ -111,69 +110,74 @@ - - + - -

Utilisateurs

-
-
- - -
- -
-

Liste d'utilisateur

-
- - - - - - - - - - - - - - - - - - - - -
IDPseudoMailRôleStatut
- +

Utilisateur

+
+ ID +
+ +
+ Pseudo + +
+ +
+ Nom + +
+ +
+ Prenom + +
+ +
+ Email + +
+ + +
+ + +
+ + +
+ Date de naissance + +
+ +
+ + +
+ + + + + +
@@ -185,5 +189,5 @@ - + \ No newline at end of file diff --git a/web/html/users.html b/web/html/users.html index b17ae9f..7418523 100644 --- a/web/html/users.html +++ b/web/html/users.html @@ -87,13 +87,14 @@ @@ -110,74 +111,69 @@ - + + + +

Utilisateurs

+
+
+ + +
+ +
-

Utilisateur

-
- ID - +

Liste d'utilisateur

+
+ + + + + + + + + + + + + + + + + + + + +
IDPseudoMailRôleStatut
+
- -
- Pseudo - -
- -
- Nom - -
- -
- Prenom - -
- -
- Email - -
- - -
- - -
- - -
- Date de naissance - -
- -
- - -
- - - - - -
diff --git a/web/js/home.js b/web/js/home.js deleted file mode 100644 index 43be496..0000000 --- a/web/js/home.js +++ /dev/null @@ -1,65 +0,0 @@ -checkToken(); -signOut(); - -var nbPages = 20; - -instance.get("users/count", { withCredentials: true }).then(function(response){ - - var count = response.data / nbPages; - var reste = response.data % nbPages; - var total = 0; - if(reste != 0){ - total = Number.parseInt(count) + 1; - } - - if(total > 1){ - - document.getElementById("page").classList.remove("hidden"); - - } - -}); - -instance.get("users", {withCredentials: true, params :{ page:0, nbPages: nbPages}}).then(function(response){ - var trTag = document.querySelector("#users tbody tr").cloneNode(true); - listData = response.data; - for (var i=0; i 0) || (pseudo.value.length > 0)){ instance.get("token", { auth : {username: pseudo.value, password: password.value}, withCredentials: true}) - .then(function(response) { location.href="html/home.html"; }) + .then(function(response) { location.href="html/users.html"; }) .catch(function(error){ switch (error.response.status){ diff --git a/web/js/user.js b/web/js/user.js new file mode 100644 index 0000000..78daf72 --- /dev/null +++ b/web/js/user.js @@ -0,0 +1,29 @@ +checkToken(); +signOut(); +var id = getQuery("id"); + +if(id.length > 0){ + instance.get("users/"+id, {withCredentials: true}) + .then(function(response){ + var listValue = [ "id", "pseudo", "name", "firstName", "email", "birth"]; + for (var i=0; i 0){ - instance.get("users/"+id, {withCredentials: true}) - .then(function(response){ - var listValue = [ "id", "pseudo", "name", "firstName", "email", "birth"]; - for (var i=0; i 1){ + + document.getElementById("page").classList.remove("hidden"); + + } + +}); + +instance.get("users", {withCredentials: true, params :{ page:0, nbPages: nbPages}}).then(function(response){ + var trTag = document.querySelector("#users tbody tr").cloneNode(true); + listData = response.data; + for (var i=0; i