forked from v4l3n71n/covas-bo
29 lines
994 B
JavaScript
29 lines
994 B
JavaScript
|
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<listValue.length; i++){
|
||
|
document.getElementById(listValue[i]+"UpdateInput").value=response.data[listValue[i]];
|
||
|
}
|
||
|
|
||
|
|
||
|
var listSelector = ["roles", "status"];
|
||
|
for (var i=0; i<listSelector.length; i++){
|
||
|
var select = document.getElementById(listSelector[i]+"Selector").querySelectorAll("option");
|
||
|
for (var j=0; j<select.length; j++){
|
||
|
if(select[j].value == response.data[listSelector[i]]){
|
||
|
select[j].setAttribute("selected", true);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
})
|
||
|
.catch(function(error){
|
||
|
console.log(error);
|
||
|
|
||
|
});
|
||
|
}
|