animate in browser context, fix clear interval
This commit is contained in:
parent
9e9407ac1c
commit
7ab8a20415
@ -170,9 +170,7 @@ export default {
|
|||||||
this.init()
|
this.init()
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
if (this.interval) {
|
|
||||||
clearInterval(this.interval)
|
clearInterval(this.interval)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async init () {
|
async init () {
|
||||||
@ -195,6 +193,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async logout () {
|
async logout () {
|
||||||
|
clearInterval(this.interval)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.$store.commit('auth/REMOVE_TOKEN')
|
await this.$store.commit('auth/REMOVE_TOKEN')
|
||||||
await this.$store.commit('auth/UPDATE_IS_LOGIN', false)
|
await this.$store.commit('auth/UPDATE_IS_LOGIN', false)
|
||||||
@ -213,6 +213,7 @@ export default {
|
|||||||
const response = await this.$axios.get('api/stats/?stats=all', { headers: { Authorization: 'Bearer ' + this.$store.state.auth.jwtToken }, progress: false })
|
const response = await this.$axios.get('api/stats/?stats=all', { headers: { Authorization: 'Bearer ' + this.$store.state.auth.jwtToken }, progress: false })
|
||||||
this.stat = response.data
|
this.stat = response.data
|
||||||
|
|
||||||
|
if (process.browser) {
|
||||||
this.interval = setInterval(async () => {
|
this.interval = setInterval(async () => {
|
||||||
await this.$store.dispatch('auth/inspectToken')
|
await this.$store.dispatch('auth/inspectToken')
|
||||||
const response = await this.$axios.get('api/stats/?stats=all', { headers: { Authorization: 'Bearer ' + this.$store.state.auth.jwtToken }, progress: false })
|
const response = await this.$axios.get('api/stats/?stats=all', { headers: { Authorization: 'Bearer ' + this.$store.state.auth.jwtToken }, progress: false })
|
||||||
@ -221,6 +222,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user