fix: add names back in live tab

This commit is contained in:
Kalane 2024-11-07 19:57:59 +01:00
parent ed9dd523ba
commit 4b15e9707d
No known key found for this signature in database
GPG key ID: B389A4E3DFF8E414
6 changed files with 31 additions and 4 deletions

View file

@ -73,13 +73,16 @@
v-if="!player.bot"
:to="{
name: 'summoner',
params: { region: $route.params.region, name: player.summonerName },
params: {
region: $route.params.region,
name: player.gameName + '-' + player.tagLine,
},
}"
:class="[
player.summonerId === account.id ? 'text-yellow-500' : 'hover:text-blue-200',
]"
class="font-semibold"
>{{ player.summonerName }}</router-link
>{{ player.gameName + '#' + player.tagLine }}</router-link
>
<div :class="[ally ? 'text-teal-300 ' : 'text-red-400 ']" class="text-xs">
{{ player.champion.name }}

View file

@ -34,6 +34,12 @@ class LiveMatchSerializer extends MatchSerializer {
redRoles = super.getTeamRoles(redTeam)
}
// Accounts
const requestsAccounts = liveMatch.participants.map((p) =>
SummonerService.getAccount(p.puuid, region)
)
const accounts = await Promise.all(requestsAccounts)
// Ranks
const requestsRanks = liveMatch.participants.map((p) =>
SummonerService.getRanked(p.summonerId, region)
@ -61,6 +67,7 @@ class LiveMatchSerializer extends MatchSerializer {
return {
...player,
role,
...accounts[index],
rank: ranks[index],
champion: this.getChampion(player.championId),
perks,

View file

@ -207,6 +207,7 @@ export interface SerializedLiveMatchPlayer {
spell1Id: number
spell2Id: number
summonerId: string
summonerName: string
gameName?: string
tagLine?: string
teamId: number
}

View file

@ -28,4 +28,15 @@ export default class AccountEndpoint {
'riot'
).execute()
}
public byPuuid(puuid: string, region: string): Promise<AccountDto> {
return new JaxRequest(
getRiotRegion(region),
this.config,
`account/v1/accounts/by-puuid/${puuid}`,
this.limiter,
36000,
'riot'
).execute()
}
}

View file

@ -33,8 +33,8 @@ export interface CurrentGameParticipantDTO {
profileIconId: number
bot: boolean
teamId: number
summonerName: string
summonerId: string
puuid: string
spell1Id: number
spell2Id: number
gameCustomizationObjects: GameCustomizationObjectDTO[]

View file

@ -5,6 +5,7 @@ import Summoner from 'App/Models/Summoner'
import { PlayerRankParsed } from 'App/Parsers/ParsedType'
import MatchPlayerRank from 'App/Models/MatchPlayerRank'
import { ACCOUNT_NAME_DELIMITER } from 'App/helpers'
import { AccountDto } from 'App/Services/Jax/src/Endpoints/AccountEndpoint'
export interface LeagueEntriesByQueue {
soloQ?: LeagueEntryByQueue
@ -81,6 +82,10 @@ class SummonerService {
return null
}
public async getAccount(puuid: string, region: string): Promise<AccountDto | null> {
return Jax.Account.byPuuid(puuid, region)
}
/**
* Return the full list of old and actual summoner names
* @param account of the summoner