This commit is contained in:
Valentin CZERYBA 2023-10-27 23:51:16 +02:00
parent 7bab6cd29a
commit 28ab29d2b9
2 changed files with 7 additions and 7 deletions

View File

@ -128,7 +128,7 @@
<button type="button" class="btn-close" aria-label="Close"></button> <button type="button" class="btn-close" aria-label="Close"></button>
</div> </div>
<div class="alert alert-warning alert-dismissible hidden" id="pseudoExistAlert" role="alert"> <div class="alert alert-warning alert-dismissible hidden" id="usernameExistAlert" role="alert">
<div>Pseudo déjà pris</div> <div>Pseudo déjà pris</div>
<button type="button" class="btn-close" aria-label="Close"></button> <button type="button" class="btn-close" aria-label="Close"></button>
</div> </div>
@ -164,8 +164,8 @@
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-text" id="pseudoUpdate">Pseudo</span> <span class="input-group-text" id="usernameUpdate">Pseudo</span>
<input id="pseudoUpdateInput" type="text" class="form-control" placeholder="Pseudo" aria-label="Pseudo" aria-describedby="pseudoUpdate"> <input id="usernameUpdateInput" type="text" class="form-control" placeholder="Pseudo" aria-label="Pseudo" aria-describedby="usernameUpdate">
</div> </div>
<div class="input-group mb-3"> <div class="input-group mb-3">

View File

@ -4,7 +4,7 @@ closeButton();
document.getElementById("addUser").addEventListener("click", function(){ document.getElementById("addUser").addEventListener("click", function(){
var updateProfil = ["pseudo", "email", "firstName", "birth", "password"]; var updateProfil = ["username", "email", "firstName", "birth", "password"];
var updateOk = true; var updateOk = true;
for (var i=0; i<updateProfil.length; i++){ for (var i=0; i<updateProfil.length; i++){
if(document.getElementById(updateProfil[i]+"UpdateInput").value.length == 0){ if(document.getElementById(updateProfil[i]+"UpdateInput").value.length == 0){
@ -27,7 +27,7 @@ document.getElementById("addUser").addEventListener("click", function(){
dataPut = { dataPut = {
"id": "", "id": "",
"pseudo": document.getElementById("pseudoUpdateInput").value, "username": document.getElementById("usernameUpdateInput").value,
"email": document.getElementById("emailUpdateInput").value, "email": document.getElementById("emailUpdateInput").value,
"name": document.getElementById("nameUpdateInput").value, "name": document.getElementById("nameUpdateInput").value,
"firstName": document.getElementById("firstNameUpdateInput").value, "firstName": document.getElementById("firstNameUpdateInput").value,
@ -51,7 +51,7 @@ document.getElementById("addUser").addEventListener("click", function(){
switch(response.status){ switch(response.status){
case 201: case 201:
idAlert="createUser" idAlert="createUser"
var user = document.getElementById("pseudoUpdateInput").value; var user = document.getElementById("usernameUpdateInput").value;
if(user.length > 0){ if(user.length > 0){
document.getElementById("displayUser").textContent=user; document.getElementById("displayUser").textContent=user;
} }
@ -68,7 +68,7 @@ document.getElementById("addUser").addEventListener("click", function(){
console.log(error); console.log(error);
switch(error.response.status){ switch(error.response.status){
case 401: case 401:
listExist = [ "pseudo", "email" ]; listExist = [ "username", "email" ];
for(var i=0; i<listExist.length; i++){ for(var i=0; i<listExist.length; i++){
if(error.response.data[listExist[i]]){ if(error.response.data[listExist[i]]){
document.getElementById(listExist[i]+"ExistAlert").classList.remove("hidden"); document.getElementById(listExist[i]+"ExistAlert").classList.remove("hidden");