add user
This commit is contained in:
parent
7bab6cd29a
commit
28ab29d2b9
@ -128,7 +128,7 @@
|
||||
<button type="button" class="btn-close" aria-label="Close"></button>
|
||||
</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>
|
||||
<button type="button" class="btn-close" aria-label="Close"></button>
|
||||
</div>
|
||||
@ -164,8 +164,8 @@
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="pseudoUpdate">Pseudo</span>
|
||||
<input id="pseudoUpdateInput" type="text" class="form-control" placeholder="Pseudo" aria-label="Pseudo" aria-describedby="pseudoUpdate">
|
||||
<span class="input-group-text" id="usernameUpdate">Pseudo</span>
|
||||
<input id="usernameUpdateInput" type="text" class="form-control" placeholder="Pseudo" aria-label="Pseudo" aria-describedby="usernameUpdate">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
|
@ -4,7 +4,7 @@ closeButton();
|
||||
|
||||
|
||||
document.getElementById("addUser").addEventListener("click", function(){
|
||||
var updateProfil = ["pseudo", "email", "firstName", "birth", "password"];
|
||||
var updateProfil = ["username", "email", "firstName", "birth", "password"];
|
||||
var updateOk = true;
|
||||
for (var i=0; i<updateProfil.length; i++){
|
||||
if(document.getElementById(updateProfil[i]+"UpdateInput").value.length == 0){
|
||||
@ -27,7 +27,7 @@ document.getElementById("addUser").addEventListener("click", function(){
|
||||
dataPut = {
|
||||
|
||||
"id": "",
|
||||
"pseudo": document.getElementById("pseudoUpdateInput").value,
|
||||
"username": document.getElementById("usernameUpdateInput").value,
|
||||
"email": document.getElementById("emailUpdateInput").value,
|
||||
"name": document.getElementById("nameUpdateInput").value,
|
||||
"firstName": document.getElementById("firstNameUpdateInput").value,
|
||||
@ -51,7 +51,7 @@ document.getElementById("addUser").addEventListener("click", function(){
|
||||
switch(response.status){
|
||||
case 201:
|
||||
idAlert="createUser"
|
||||
var user = document.getElementById("pseudoUpdateInput").value;
|
||||
var user = document.getElementById("usernameUpdateInput").value;
|
||||
if(user.length > 0){
|
||||
document.getElementById("displayUser").textContent=user;
|
||||
}
|
||||
@ -68,7 +68,7 @@ document.getElementById("addUser").addEventListener("click", function(){
|
||||
console.log(error);
|
||||
switch(error.response.status){
|
||||
case 401:
|
||||
listExist = [ "pseudo", "email" ];
|
||||
listExist = [ "username", "email" ];
|
||||
for(var i=0; i<listExist.length; i++){
|
||||
if(error.response.data[listExist[i]]){
|
||||
document.getElementById(listExist[i]+"ExistAlert").classList.remove("hidden");
|
||||
|
Loading…
x
Reference in New Issue
Block a user