Answer the question
In order to leave comments, you need to log in
Vue js how to send axios on click to any place on the page?
It is necessary that if the user clicked on any place on the page, the axios request for the php file worked. I didn’t understand how to make axios send on click, but I only did it so that axios worked when the page loaded. How can I make it work on click?
data() {
return {
info: ''
}
},
mounted() {
axios
.get(url + '/lk_src/checkAuth.php')
.then(response => {
this.info = response.data;
console.log(this.info);
if (this.info == 'NoAuthorization') {
this.$store.dispatch('auth/logout').catch(()=>{});
this.$router.push('/login').catch(()=>{});
}
})
},
//тут типо должен быть обработчик клика на странице, но как вызвать axios по нему, так и не понял
document.addEventListener("click", function() {
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question