mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
fix(api): if Riot League endpoint is down: prevent crashing
This commit is contained in:
parent
8a9299d302
commit
9a886165ff
1 changed files with 6 additions and 3 deletions
|
|
@ -77,10 +77,13 @@ class SummonerService {
|
||||||
*/
|
*/
|
||||||
public async getRanked (account: SummonerDTO, region: string): Promise<LeagueEntriesByQueue> {
|
public async getRanked (account: SummonerDTO, region: string): Promise<LeagueEntriesByQueue> {
|
||||||
const ranked = await Jax.League.summonerID(account.id, region)
|
const ranked = await Jax.League.summonerID(account.id, region)
|
||||||
const result = {
|
const result:LeagueEntriesByQueue = {}
|
||||||
soloQ: this.getleagueData(ranked.find(e => e.queueType === 'RANKED_SOLO_5x5')) || undefined,
|
|
||||||
flex5v5: this.getleagueData(ranked.find(e => e.queueType === 'RANKED_FLEX_SR')) || undefined,
|
if (ranked && ranked.length) {
|
||||||
|
result.soloQ = this.getleagueData(ranked.find(e => e.queueType === 'RANKED_SOLO_5x5')) || undefined
|
||||||
|
result.flex5v5 = this.getleagueData(ranked.find(e => e.queueType === 'RANKED_FLEX_SR')) || undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue