2023-08-09 17:20:03 +00:00
|
|
|
import { RatingsInfo } from '../../commands/ratings';
|
|
|
|
|
import { Region } from '../../constants/regions';
|
2023-10-31 11:41:04 -05:00
|
|
|
import { withCORSProxy } from '../blitzkrieg/withCORSProxy';
|
2023-08-09 17:20:03 +00:00
|
|
|
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
|
|
|
|
|
|
|
|
|
export default async function getRatingsInfo(region: Region) {
|
|
|
|
|
const response = await fetch(
|
2023-10-31 11:41:04 -05:00
|
|
|
withCORSProxy(
|
2023-10-31 11:43:28 -05:00
|
|
|
`https://${regionToRegionSubdomain(
|
|
|
|
|
region,
|
|
|
|
|
)}.wotblitz.com/en/api/rating-leaderboards/season/`,
|
2023-10-31 11:41:04 -05:00
|
|
|
),
|
2023-08-09 17:20:03 +00:00
|
|
|
);
|
2023-09-03 18:15:10 +00:00
|
|
|
|
2023-08-09 17:20:03 +00:00
|
|
|
return (await response.json()) as Promise<RatingsInfo>;
|
|
|
|
|
}
|