add checktoken interceptors and remove loop refresh

This commit is contained in:
2022-07-25 23:46:32 +02:00
parent e208c55811
commit 950669bd0e
3 changed files with 17 additions and 4 deletions

6
web/js/home.js Normal file
View File

@@ -0,0 +1,6 @@
checkToken();
const requestInterceptors = axios.interceptors.request.use(function(){
checkToken();
});

View File

@@ -1,7 +1,12 @@
function checkToken(){
instance.get("token", { withCredentials: true})
.then(function(response) { location.href="html/home.html"; })
.then(function(response) {
if(location.href.pathname == "/")
{
location.href="/html/home.html";
}
})
.catch(function(error){
location.href="/";
});