fix(more-matches): apply season filter in more matches results

This commit is contained in:
Valentin Kaelin 2020-11-06 22:09:18 +01:00
parent f869e5b12c
commit f0a0731ddc

View file

@ -175,10 +175,13 @@ export const actions = {
commit('SUMMONER_NOT_PLAYING') commit('SUMMONER_NOT_PLAYING')
} }
}, },
async moreMatches({ commit, rootState }) { async moreMatches({ commit, getters, rootState }) {
commit('MATCHES_LOADING') commit('MATCHES_LOADING')
const gameIds = state.basic.matchList.slice(state.overview.matchIndex, state.overview.matchIndex + 10).map(({ gameId }) => gameId) const gameIds = state.basic.matchList
.filter(match => !getters.regionFilterApplied || match.seasonMatch === state.basic.currentSeason)
.slice(state.overview.matchIndex, state.overview.matchIndex + 10)
.map(({ gameId }) => gameId)
const resp = await axios(({ const resp = await axios(({
url: 'match', url: 'match',
@ -231,6 +234,7 @@ export const getters = {
moreMatchesToFetch: state => state.overview.matchIndex < state.basic.matchList.length, moreMatchesToFetch: state => state.overview.matchIndex < state.basic.matchList.length,
overviewLoaded: state => state.overview.loaded, overviewLoaded: state => state.overview.loaded,
playing: state => state.live.playing, playing: state => state.live.playing,
regionFilterApplied: state => !!state.basic.currentSeason,
summonerFound: state => state.basic.status === 'found', summonerFound: state => state.basic.status === 'found',
summonerNotFound: state => state.basic.status === 'error', summonerNotFound: state => state.basic.status === 'error',
summonerLoading: state => state.basic.status === 'loading', summonerLoading: state => state.basic.status === 'loading',