style: remove old comments and change method names

This commit is contained in:
Valentin Kaelin 2020-01-01 16:39:54 +01:00
parent 1c9e2b8d70
commit fe60e85b6a
7 changed files with 13 additions and 24 deletions

View file

@ -19,7 +19,7 @@
<div class="px-2 text-white text-center text-sm select-none"> <div class="px-2 text-white text-center text-sm select-none">
<div>Stats based on</div> <div>Stats based on</div>
<div> <div>
<span class="text-teal-400 font-bold">{{ stats.global.count }}</span> matches <span class="text-teal-400 font-bold">{{ stats.global ? stats.global.count : 0 }}</span> matches
</div> </div>
<div class="mt-2 leading-tight text-xs text-blue-100 font-normal italic"> <div class="mt-2 leading-tight text-xs text-blue-100 font-normal italic">
Load more matches Load more matches

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="mt-4 bg-blue-800 rounded-lg"> <div v-if="stats.global" class="mt-4 bg-blue-800 rounded-lg">
<div class="relative heading flex justify-center py-4 rounded-t-lg text-blue-200"> <div class="relative heading flex justify-center py-4 rounded-t-lg text-blue-200">
<svg class="w-6 h-6"> <svg class="w-6 h-6">
<use xlink:href="#graph" /> <use xlink:href="#graph" />

View file

@ -124,18 +124,17 @@ export default {
return `${this.summoner}|${this.region}` return `${this.summoner}|${this.region}`
}, },
tabTransition() { tabTransition() {
return this.summonerFound ? 'tab' : 'none' return this.summonerFound && this.overviewLoaded ? 'tab' : 'none'
}, },
...mapState({ ...mapState({
basic: state => state.summoner.basic basic: state => state.summoner.basic
}), }),
...mapGetters('summoner', ['playing', 'summonerFound', 'summonerNotFound', 'summonerLoading']) ...mapGetters('summoner', ['playing', 'overviewLoaded', 'summonerFound', 'summonerNotFound', 'summonerLoading'])
}, },
watch: { watch: {
uri() { uri() {
console.log('route changed') console.log('route changed')
// console.log(this.$router.currentRoute)
this.updateCurrentRegion(this.region) this.updateCurrentRegion(this.region)
this.apiCall() this.apiCall()
} }

View file

@ -69,7 +69,7 @@ export const actions = {
try { try {
const resp = await axios(({ url: 'summoner-basic', data: { summoner, region }, method: 'POST' })) const resp = await axios(({ url: 'summoner-basic', data: { summoner, region }, method: 'POST' }))
if (resp.data) { if (resp.data) {
console.log('--- SUMMONER INFOS ---') console.log('---SUMMONER INFOS---')
console.log(resp.data) console.log(resp.data)
const infos = createBasicSummonerData(resp.data) const infos = createBasicSummonerData(resp.data)
commit('SUMMONER_FOUND', infos) commit('SUMMONER_FOUND', infos)
@ -87,10 +87,9 @@ export const actions = {
console.log(error) console.log(error)
} }
}, },
async championStats({ commit }, queue = null) { async championsRequest({ commit }, queue = null) {
const resp = await axios(({ url: 'summoner-champions', data: { puuid: state.basic.account.puuid, queue: queue }, method: 'POST' })).catch(() => { }) const resp = await axios(({ url: 'summoner-champions', data: { puuid: state.basic.account.puuid, queue: queue }, method: 'POST' })).catch(() => { })
console.log('CHAMPIONS STATS') console.log('---CHAMPIONS---')
console.log('queue: ', queue)
console.log(resp.data) console.log(resp.data)
commit('CHAMPIONS_FOUND', { champions: resp.data }) commit('CHAMPIONS_FOUND', { champions: resp.data })
@ -102,20 +101,14 @@ export const actions = {
const gameIds = state.basic.matchList.slice(state.overview.matchIndex, state.overview.matchIndex + 10).map(({ gameId }) => gameId) const gameIds = state.basic.matchList.slice(state.overview.matchIndex, state.overview.matchIndex + 10).map(({ gameId }) => gameId)
const resp = await axios(({ url: 'match', data: { account, gameIds }, method: 'POST' })).catch(() => { }) const resp = await axios(({ url: 'match', data: { account, gameIds }, method: 'POST' })).catch(() => { })
console.log('--- MATCHES INFOS ---') console.log('---MATCHES INFOS---')
console.log(resp.data) console.log(resp.data)
const newMatches = createMatchData(resp.data.matches) const newMatches = createMatchData(resp.data.matches)
commit('MATCHES_FOUND', { newMatches, stats: resp.data.stats }) commit('MATCHES_FOUND', { newMatches, stats: resp.data.stats })
}, },
async overviewRequest({ commit }) { async overviewRequest({ commit }) {
const resp = await axios(({ url: 'summoner-overview', data: { account: state.basic.account }, method: 'POST' })).catch(() => { }) const resp = await axios(({ url: 'summoner-overview', data: { account: state.basic.account }, method: 'POST' })).catch(() => { })
// setTimeout(() => { console.log('---OVERVIEW---')
// console.log('OVERVIEW')
// console.log(resp.data)
// resp.data.matches = createMatchData(resp.data.matchesDetails)
// commit('OVERVIEW_FOUND', resp.data)
// }, 2000)
console.log('OVERVIEW')
console.log(resp.data) console.log(resp.data)
resp.data.matches = createMatchData(resp.data.matchesDetails) resp.data.matches = createMatchData(resp.data.matchesDetails)
commit('OVERVIEW_FOUND', resp.data) commit('OVERVIEW_FOUND', resp.data)

View file

@ -5,7 +5,7 @@
<SummonerStats /> <SummonerStats />
<SummonerMates /> <SummonerMates />
</div> </div>
<div class="w-9/12"> <div v-if="overview.matches.length" class="w-9/12">
<ul> <ul>
<Match <Match
v-for="(match, index) in overview.matches" v-for="(match, index) in overview.matches"
@ -318,7 +318,6 @@ export default {
methods: { methods: {
fetchData() { fetchData() {
if (!this.overviewLoaded && this.summonerFound) { if (!this.overviewLoaded && this.summonerFound) {
console.log('FETCHING OVERVIEW')
this.overviewRequest() this.overviewRequest()
} }
}, },

View file

@ -65,19 +65,18 @@ export default {
methods: { methods: {
fetchData() { fetchData() {
if (!this.championsLoaded && this.summonerFound) { if (!this.championsLoaded && this.summonerFound) {
console.log('FETCHING CHAMPIONS') this.championsRequest()
this.championStats()
} }
}, },
filterByQueue(queue) { filterByQueue(queue) {
queue = Number(queue) queue = Number(queue)
queue = queue === -1 ? null : queue queue = queue === -1 ? null : queue
this.championStats(queue) this.championsRequest(queue)
}, },
updateSearch(search) { updateSearch(search) {
this.searchChampions = search this.searchChampions = search
}, },
...mapActions('summoner', ['championStats']), ...mapActions('summoner', ['championsRequest']),
} }
} }
</script> </script>

View file

@ -68,7 +68,6 @@ class SummonerController {
async overview({ request, response }) { async overview({ request, response }) {
console.time('overview') console.time('overview')
const account = request.input('account') const account = request.input('account')
console.log(account)
const finalJSON = {} const finalJSON = {}
// Summoner in DB // Summoner in DB