dashboard wip
This commit is contained in:
parent
e86a4aa0cf
commit
7022508ec0
@ -1,15 +1,14 @@
|
|||||||
checkToken();
|
checkToken();
|
||||||
|
|
||||||
axios.interceptors.request.use(function (config) {
|
|
||||||
checkToken();
|
|
||||||
return config;
|
|
||||||
}, function (error) {
|
|
||||||
// Do something with request error
|
|
||||||
return Promise.reject(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
instance.get("users/count", { withCredentials: true }).then(function(response){
|
instance.get("users/count", { withCredentials: true }).then(function(response){
|
||||||
var countTable = document.getElementById("users").querySelector("tbody").querySelectorAll("tr").length;
|
var countTable = document.querySelectorAll("#users tbody tr").length;
|
||||||
|
var count = response.data / countTable;
|
||||||
|
var reste = response.data % countTable;
|
||||||
|
|
||||||
|
if(reste != 0){
|
||||||
|
var total = Number.parseInt(count) + 1;
|
||||||
|
console.log(total);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
@ -2,13 +2,15 @@ function checkToken(){
|
|||||||
|
|
||||||
instance.get("token", { withCredentials: true})
|
instance.get("token", { withCredentials: true})
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
if(location.href.pathname == "/")
|
if(location.pathname == "/")
|
||||||
{
|
{
|
||||||
location.href="/html/home.html";
|
location.href="/html/home.html";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function(error){
|
.catch(function(error){
|
||||||
|
if(location.pathname != "/"){
|
||||||
location.href="/";
|
location.href="/";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user