From 4a0a76686e51a6eb9e30fb7c3847df0212f1cc31 Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Mon, 20 Jan 2020 21:54:04 +0100 Subject: [PATCH] fix: compare summonerId or accountId instead of summonerNames in vue --- client/src/components/Match/DetailedMatch.vue | 11 +++++++---- client/src/components/Match/DetailedMatchTeam.vue | 5 ++--- client/src/components/Match/Match.vue | 8 ++++---- client/src/helpers/functions.js | 9 --------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/client/src/components/Match/DetailedMatch.vue b/client/src/components/Match/DetailedMatch.vue index 29a8130..ba8439d 100644 --- a/client/src/components/Match/DetailedMatch.vue +++ b/client/src/components/Match/DetailedMatch.vue @@ -26,7 +26,7 @@ diff --git a/client/src/components/Match/DetailedMatchTeam.vue b/client/src/components/Match/DetailedMatchTeam.vue index f3b17ff..87a5c45 100644 --- a/client/src/components/Match/DetailedMatchTeam.vue +++ b/client/src/components/Match/DetailedMatchTeam.vue @@ -124,7 +124,7 @@ {{ player.name }}
import { mapState } from 'vuex' -import { compareSummonernames } from '@/helpers/functions.js' import DotsLoader from '@/components/DotsLoader' import Dropdown from '@/components/Dropdown' import MatchItems from '@/components/Match/MatchItems' @@ -230,6 +229,7 @@ export default { return this.percentSettings ? 'percentStats' : 'stats' }, ...mapState({ + account: state => state.summoner.basic.account, percentSettings: state => state.settings.percent }), }, @@ -251,7 +251,6 @@ export default { roundStats(value) { return this.percentSettings ? value : this.$options.filters.kilo(value) }, - compareSummonernames, } } diff --git a/client/src/components/Match/Match.vue b/client/src/components/Match/Match.vue index 3329fc8..bd2695d 100644 --- a/client/src/components/Match/Match.vue +++ b/client/src/components/Match/Match.vue @@ -102,7 +102,7 @@ class="ml-4 flex items-center leading-none" >
{{ ally.name }}
import { mapActions, mapState, mapGetters } from 'vuex' -import { compareSummonernames } from '@/helpers/functions.js' import Dropdown from '@/components/Dropdown' import DetailedMatch from '@/components/Match/DetailedMatch' import MatchItems from '@/components/Match/MatchItems' @@ -180,6 +179,7 @@ export default { computed: { ...mapState({ + account: state => state.summoner.basic.account, roles: state => state.roles }), ...mapGetters('detailedMatch', ['getMatchDetails']), @@ -193,9 +193,9 @@ export default { this.matchDetails(this.data.gameId) } }, - isSummonerProfile(allyName) { + isSummonerProfile(account_id) { return { - 'font-bold': compareSummonernames(this.$route.params.name, allyName) + 'font-bold': this.account.accountId === account_id } }, ...mapActions('detailedMatch', ['matchDetails']), diff --git a/client/src/helpers/functions.js b/client/src/helpers/functions.js index 54498e3..ed9aaff 100644 --- a/client/src/helpers/functions.js +++ b/client/src/helpers/functions.js @@ -25,12 +25,3 @@ export function timeDifference(previous) { return day + '.' + month + '.' + oldDate.getFullYear().toString().substr(-2) } } - -/** - * Check if 2 summoner names are the same - * @param a : first summoner name - * @param b : second summoner name - */ -export function compareSummonernames(a, b) { - return a.toLowerCase().replace(/ /g, '') === b.toLowerCase().replace(/ /g, '') -}