forked from v4l3n71n/covas-bo
add checktoken interceptors and remove loop refresh
This commit is contained in:
6
web/js/home.js
Normal file
6
web/js/home.js
Normal file
@@ -0,0 +1,6 @@
|
||||
checkToken();
|
||||
|
||||
const requestInterceptors = axios.interceptors.request.use(function(){
|
||||
checkToken();
|
||||
});
|
||||
|
@@ -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="/";
|
||||
});
|
||||
|
Reference in New Issue
Block a user