0👍
resolved with:
checkLogged: function() {
return new Promise((resolve,reject) => {
this.$http.get('xxx').then(response => {
if (response.body == 1) {
resolve(true);
} else {
resolve(false);
}
}, response => {
reject('connection failure');
});
});
},
and in 2nd file:
this.$root.checkLogged().then((response) => {
if(response){
this.logged = true
}else{
router.push("/")
}
})
Source:stackexchange.com