fix: last one... (hope so)

This commit is contained in:
Valentin Kaelin 2022-01-31 23:17:37 +01:00
parent 4fb7c4d6da
commit 565e2b32fa
2 changed files with 4 additions and 2 deletions

View file

@ -57,7 +57,9 @@ export const mutations = {
},
KEEP_LAST_X_MATCHES(state, number) {
state.overview.matches = state.overview.matches.slice(0, number)
state.overview.lastMatchId = state.overview.matches[state.overview.matches.length - 1].matchId
if (state.overview.matches.length > 0) {
state.overview.lastMatchId = state.overview.matches[state.overview.matches.length - 1].matchId
}
},
LIVE_FOUND(state, { live }) {
state.live.match = live

View file

@ -102,7 +102,7 @@ export default {
this.overviewRequest()
}
// Keep only the 10 last matches when summoner enters overview page
else if (this.overviewLoaded && this.summonerFound && this.overview.matches.length !== 10) {
else if (this.overviewLoaded && this.summonerFound && this.overview.matches.length > 10) {
this.sliceOverviewMatches(10)
}
},