api changes

This commit is contained in:
root 2025-06-25 12:27:52 +02:00
parent af161537d7
commit 1126c355da
1 changed files with 4 additions and 5 deletions

View File

@ -87,10 +87,10 @@ export async function fetchSummoner ( puuid: string )
return res.json(); return res.json();
} }
export async function fetchRankedStats ( summonerId: string ) export async function fetchRankedStats ( puuid: string )
{ {
const res = await fetch( const res = await fetch(
`https://${ REGION }.api.riotgames.com/lol/league/v4/entries/by-summoner/${ summonerId }`, `https://${ REGION }.api.riotgames.com/lol/league/v4/entries/by-puuid/${ puuid }`,
{ headers } { headers }
); );
if ( !res.ok ) return {}; if ( !res.ok ) return {};
@ -177,10 +177,9 @@ export async function fetchMatches ( puuid: string )
export async function getRankedData ( name: string, tag: string ) export async function getRankedData ( name: string, tag: string )
{ {
const account = await fetchAccount( name, tag ); const account = await fetchAccount( name, tag );
const summoner = await fetchSummoner( account.puuid );
const [ matches, rankedStats ] = await Promise.all( [ const [ matches, rankedStats ] = await Promise.all( [
fetchSixMatches( account.puuid ), fetchSixMatches( account.puuid ),
fetchRankedStats( summoner.id ), fetchRankedStats( account.puuid ),
] ); ] );
return { ...rankedStats, matches }; return { ...rankedStats, matches };
@ -195,7 +194,7 @@ export async function getSessionData ( name: string, tag: string )
const summoner = await fetchSummoner( account.puuid ); const summoner = await fetchSummoner( account.puuid );
const [ matches, rankedStats ] = await Promise.all( [ const [ matches, rankedStats ] = await Promise.all( [
fetchMatches( account.puuid ), fetchMatches( account.puuid ),
fetchRankedStats( summoner.id ), fetchRankedStats( account.puuid ),
] ); ] );
const recentMatches = matches.filter( ( match ) => !match.isOld ); const recentMatches = matches.filter( ( match ) => !match.isOld );