mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
fix: timer really fix this time, hopefully
This commit is contained in:
parent
fc206ffe6c
commit
29605d4de9
3 changed files with 18 additions and 9 deletions
|
|
@ -23,7 +23,7 @@
|
|||
<router-link
|
||||
v-if="!ally.bot"
|
||||
:to="{ name: 'summoner', params: { region: $route.params.region, name: ally.summonerName }}"
|
||||
:class="[compareSummonernames($route.params.name, ally.summonerName) ? 'text-white' : 'text-blue-200']"
|
||||
:class="[ally.summonerId === account.id ? 'text-white' : 'text-blue-200']"
|
||||
class="relative ml-2 hover:text-white"
|
||||
>{{ ally.summonerName }}</router-link>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { compareSummonernames } from '@/helpers/functions.js'
|
||||
import { gameModes } from '@/data/data.js'
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
|
|
@ -26,7 +25,7 @@ export const liveGame = {
|
|||
return gameModes[this.current.gameQueueConfigId]
|
||||
},
|
||||
gameStartTime() {
|
||||
return (new Date() - new Date(this.current.gameStartTime)) / 1000
|
||||
return this.current.gameStartTime
|
||||
},
|
||||
teamColor() {
|
||||
return this.current.participants.find(p => p.summonerId === this.account.id).teamId
|
||||
|
|
@ -38,14 +37,26 @@ export const liveGame = {
|
|||
},
|
||||
|
||||
created() {
|
||||
this.gameLength = this.current ? this.gameStartTime : 0
|
||||
this.updateGameLength()
|
||||
|
||||
setInterval(() => {
|
||||
this.gameLength++
|
||||
}, 1000)
|
||||
},
|
||||
|
||||
watch: {
|
||||
gameStartTime() {
|
||||
this.updateGameLength()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
compareSummonernames,
|
||||
updateGameLength() {
|
||||
if (this.gameStartTime === 0) {
|
||||
return this.gameLength = 0
|
||||
}
|
||||
|
||||
this.gameLength = (new Date() - new Date(this.gameStartTime)) / 1000
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ export default {
|
|||
watch: {
|
||||
summonerFound() {
|
||||
this.fetchData()
|
||||
this.gameLength = this.live ? this.gameStartTime : 0
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -59,10 +58,9 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
async fetchData() {
|
||||
fetchData() {
|
||||
if (this.playing && !this.liveLoaded && this.summonerFound) {
|
||||
await this.liveMatchRequest()
|
||||
this.gameLength = this.gameStartTime
|
||||
this.liveMatchRequest()
|
||||
}
|
||||
},
|
||||
...mapActions('summoner', ['liveMatchRequest']),
|
||||
|
|
|
|||
Loading…
Reference in a new issue