diff --git a/web/js/home.js b/web/js/home.js index 202552d..c4f876d 100644 --- a/web/js/home.js +++ b/web/js/home.js @@ -1,15 +1,14 @@ 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){ - 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); + + } }) \ No newline at end of file diff --git a/web/js/library.js b/web/js/library.js index b78e6b0..5291fae 100644 --- a/web/js/library.js +++ b/web/js/library.js @@ -2,13 +2,15 @@ function checkToken(){ instance.get("token", { withCredentials: true}) .then(function(response) { - if(location.href.pathname == "/") + if(location.pathname == "/") { location.href="/html/home.html"; } }) .catch(function(error){ - location.href="/"; + if(location.pathname != "/"){ + location.href="/"; + } }); } \ No newline at end of file