feat: current season traversal

This commit is contained in:
TrèsAbhi committed 2023-11-07 20:47:20 -06:00
1 parent 059b78c9fb
commit 212aee0373
2 files changed
+156 -80

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import { RatingsNeighbors } from '../../commands/ratings';
import { Region } from '../../constants/regions';
import { patientFetch } from '../blitzkrieg/patientFetch';
import { withCORSProxy } from '../blitzkrieg/withCORSProxy';
import regionToRegionSubdomain from './regionToRegionSubdomain';
export async function getRatingsNeighbors(
region: Region,
id: number,
count = 30,
usePatientFetcher = false,
) {
const fetcher = usePatientFetcher ? patientFetch : fetch;
const response = await fetcher(
withCORSProxy(
`https://${regionToRegionSubdomain(
region,
)}.wotblitz.com/en/api/rating-leaderboards/user/${id}/?neighbors=${count}`,
),
);
const json = (await response.json()) as RatingsNeighbors;
return json;
}