2023-08-09 17:20:03 +00:00
|
|
|
import { RatingsInfo } from '../../commands/ratings';
|
|
|
|
|
import { Region } from '../../constants/regions';
|
2023-11-11 21:37:59 -06:00
|
|
|
import { context } from '../blitzkrieg/context';
|
2023-08-09 17:20:03 +00:00
|
|
|
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
|
|
|
|
|
|
|
|
|
export default async function getRatingsInfo(region: Region) {
|
|
|
|
|
const response = await fetch(
|
2023-11-11 21:37:59 -06:00
|
|
|
context === 'website'
|
|
|
|
|
? `/api/${region}/ratings/current/info`
|
|
|
|
|
: `https://${regionToRegionSubdomain(
|
|
|
|
|
region,
|
|
|
|
|
)}.wotblitz.com/en/api/rating-leaderboards/season/`,
|
2023-11-14 07:34:47 -06:00
|
|
|
{ cache: 'no-store' },
|
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>;
|
|
|
|
|
}
|