+
gameId)
+
+ const resp = await axios(({ url: 'match', data: { account, gameIds }, method: 'POST' })).catch(() => { })
+ commit('MATCHES_FOUND', createMatchData(resp.data))
+ },
async summonerRequest({ commit, dispatch, rootState }, { summoner, region }) {
region = rootState.regionsList[region]
commit('SUMMONER_REQUEST')
@@ -47,6 +69,7 @@ export const actions = {
}
export const getters = {
+ moreMatchesToFetch: state => state.infos.matchIndex < state.infos.matchList.length,
summonerFound: state => state.status === 'found',
summonerNotFound: state => state.status === 'error',
summonerLoading: state => state.status === 'loading',
diff --git a/client/src/views/Summoner.vue b/client/src/views/Summoner.vue
index 4673a19..f07a90b 100644
--- a/client/src/views/Summoner.vue
+++ b/client/src/views/Summoner.vue
@@ -23,8 +23,8 @@
@@ -34,7 +34,7 @@
>
+ >{{ summonerInfos.account.summonerLevel }}
@@ -73,7 +73,7 @@
-
+
@@ -86,6 +86,12 @@
/>
+
+
@@ -121,7 +127,7 @@ export default {
computed: {
getSummonerIcon() {
- return `url(https://ddragon.leagueoflegends.com/cdn/${this.$patch}/img/profileicon/${this.summonerInfos.profileIconId}.png) center/cover`
+ return `url(https://ddragon.leagueoflegends.com/cdn/${this.$patch}/img/profileicon/${this.summonerInfos.account.profileIconId}.png) center/cover`
},
summoner() {
return this.$route.params.name
@@ -132,7 +138,7 @@ export default {
...mapState({
summonerInfos: state => state.summoner.infos
}),
- ...mapGetters('summoner', ['summonerFound', 'summonerNotFound', 'summonerLoading'])
+ ...mapGetters('summoner', ['moreMatchesToFetch', 'summonerFound', 'summonerNotFound', 'summonerLoading'])
},
watch: {
@@ -153,7 +159,7 @@ export default {
redirect(summoner, region) {
this.$router.push(`/summoner/${region}/${summoner}`)
},
- ...mapActions('summoner', ['summonerRequest'])
+ ...mapActions('summoner', ['summonerRequest', 'moreMatches']),
}
}
diff --git a/server/app/Controllers/Http/MatchController.js b/server/app/Controllers/Http/MatchController.js
new file mode 100644
index 0000000..c156e59
--- /dev/null
+++ b/server/app/Controllers/Http/MatchController.js
@@ -0,0 +1,19 @@
+'use strict'
+
+const MatchHelper = use('App/Helpers/MatchHelper')
+
+class MatchController {
+ /**
+ * POST - Return data from matches searched by gameIds
+ */
+ async index({ request, response }) {
+ console.log('More Matches Request')
+ const account = request.input('account')
+ const gameIds = request.input('gameIds')
+
+ const result = await MatchHelper.getMatches(account, gameIds)
+ return response.json(result)
+ }
+}
+
+module.exports = MatchController
diff --git a/server/app/Controllers/Http/SummonerController.js b/server/app/Controllers/Http/SummonerController.js
index abe2744..9a93307 100644
--- a/server/app/Controllers/Http/SummonerController.js
+++ b/server/app/Controllers/Http/SummonerController.js
@@ -4,7 +4,6 @@ const Jax = use('Jax')
const MatchHelper = use('App/Helpers/MatchHelper')
class SummonerController {
-
/**
* POST Endpoint : get summoner data
*/
diff --git a/server/app/Transformers/MatchTransformer.js b/server/app/Transformers/MatchTransformer.js
index d90e7f8..f544c8d 100644
--- a/server/app/Transformers/MatchTransformer.js
+++ b/server/app/Transformers/MatchTransformer.js
@@ -55,17 +55,20 @@ class MatchTransformer extends BumblebeeTransformer {
}, 0)
const kp = +((kills + assists) * 100 / totalKills).toFixed(1) + '%'
- const primaryRuneCategory = runes.find(r => r.id === player.stats.perkPrimaryStyle)
- let primaryRune
- for (const subCat of primaryRuneCategory.slots) {
- primaryRune = subCat.runes.find(r => r.id === player.stats.perk0)
- if (primaryRune) {
- break
+ let primaryRune = null
+ let secondaryRune = null
+ if(player.stats.perkPrimaryStyle) {
+ const primaryRuneCategory = runes.find(r => r.id === player.stats.perkPrimaryStyle)
+ for (const subCat of primaryRuneCategory.slots) {
+ primaryRune = subCat.runes.find(r => r.id === player.stats.perk0)
+ if (primaryRune) {
+ break
+ }
}
+ primaryRune = `https://ddragon.leagueoflegends.com/cdn/img/${primaryRune.icon}`
+ secondaryRune = runes.find(r => r.id === player.stats.perkSubStyle)
+ secondaryRune = `https://ddragon.leagueoflegends.com/cdn/img/${secondaryRune.icon}`
}
- primaryRune = `https://ddragon.leagueoflegends.com/cdn/img/${primaryRune.icon}`
- let secondaryRune = runes.find(r => r.id === player.stats.perkSubStyle)
- secondaryRune = `https://ddragon.leagueoflegends.com/cdn/img/${secondaryRune.icon}`
const items = []
for (let i = 0; i < 6; i++) {
diff --git a/server/start/routes.js b/server/start/routes.js
index be173ab..b6960a8 100644
--- a/server/start/routes.js
+++ b/server/start/routes.js
@@ -27,3 +27,4 @@ Route.get('/', async () => {
Route.post('/api', 'SummonerController.api')
Route.post('/ddragon', 'DDragonController.index')
+Route.post('/match', 'MatchController.index')