get only statistics when user is login and index page is open

This commit is contained in:
jb-alvarado 2021-04-03 21:11:56 +02:00
parent 347b6654ef
commit 11555979e2

View File

@ -234,8 +234,12 @@ export default {
if (process.browser && !this.interval) {
this.interval = setInterval(async () => {
const response = await this.$axios.get('api/player/stats/?stats=all')
this.stat = response.data
if (this.$store.state.auth.isLogin && this.$route.path === '/') {
const response = await this.$axios.get('api/player/stats/?stats=all')
this.stat = response.data
} else {
clearInterval(this.interval)
}
}, 2000)
}
}