From 11555979e2104c1ed14a5c541f13c96adc68d9bd Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Sat, 3 Apr 2021 21:11:56 +0200 Subject: [PATCH] get only statistics when user is login and index page is open --- pages/index.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index 06744bd1..c8fe6039 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -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) } }