check roles users
This commit is contained in:
parent
326b21a65c
commit
03ec97003e
@ -9,7 +9,13 @@ document.getElementById("signin").addEventListener("submit", function(evt){
|
||||
authData = {username: pseudo.value, password: password.value}
|
||||
instance.post("token", {username: pseudo.value, password: password.value}, {headers: {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' }})
|
||||
.then(function(response) {
|
||||
location.href="html/users.html"; })
|
||||
if(response.data["roles"] == "Admin"){
|
||||
location.href="html/users.html";
|
||||
}
|
||||
else {
|
||||
instance.delete("token")
|
||||
}
|
||||
})
|
||||
.catch(function(error){
|
||||
|
||||
switch (error.response.status){
|
||||
|
Loading…
x
Reference in New Issue
Block a user