forked from v4l3n71n/covas-bo
variable for item
This commit is contained in:
parent
ec677a30ab
commit
6fdfc80880
@ -369,5 +369,5 @@
|
||||
|
||||
<script src="../js/config.js"></script>
|
||||
<script src="../js/library.js"></script>
|
||||
<script src="../js/user.js"></script>
|
||||
<script src="../js/item.js"></script>
|
||||
</body></html>
|
@ -1,10 +1,12 @@
|
||||
checkToken();
|
||||
signOut();
|
||||
closeButton();
|
||||
pathURL = document.location.pathname.split("/")[document.location.pathname.split("/").length-1].split(".")[0]
|
||||
|
||||
var id = getQuery("id");
|
||||
|
||||
if(id.length > 0){
|
||||
instance.get("users/"+id, {withCredentials: true})
|
||||
instance.get(pathURL + "s/"+id, {withCredentials: true})
|
||||
.then(function(response){
|
||||
var listValue = [ "id", "username", "name", "firstName", "email", "birth"];
|
||||
var listTime = ["connected_at", "created_at", "updated_at", "deleted_at", "disabled_at"];
|
||||
@ -64,15 +66,15 @@ if(id.length > 0){
|
||||
switch(e.currentTarget.id){
|
||||
case "disableUserButton":
|
||||
httpMethod = "delete";
|
||||
httpUrl = "users/"+idInput;
|
||||
httpUrl = pathURL + "s/"+idInput;
|
||||
break;
|
||||
case "removeUserButton":
|
||||
httpMethod = "delete";
|
||||
httpUrl = "users/"+idInput+"?remove=true";
|
||||
httpUrl = pathURL + "s/"+idInput+"?remove=true";
|
||||
break;
|
||||
default:
|
||||
httpMethod = "patch";
|
||||
httpUrl = "users/"+idInput;
|
||||
httpUrl = pathURL + "s/"+idInput;
|
||||
break;
|
||||
}
|
||||
instance({
|
||||
@ -82,7 +84,7 @@ if(id.length > 0){
|
||||
})
|
||||
.then(function(response){
|
||||
if(response.status == 200){
|
||||
location.href="/html/user.html?id="+idInput;
|
||||
location.href="/html/"+pathURL+".html?id="+idInput;
|
||||
}
|
||||
})
|
||||
.catch(function(error){
|
||||
@ -140,7 +142,7 @@ if(id.length > 0){
|
||||
}
|
||||
instance({
|
||||
method : "put",
|
||||
url:"users/"+document.getElementById("idUpdateInput").value,
|
||||
url:pathURL+"s/"+document.getElementById("idUpdateInput").value,
|
||||
withCredentials: true,
|
||||
data: dataPut
|
||||
}).then(function(response){
|
Loading…
x
Reference in New Issue
Block a user