mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
20 lines
683 B
TypeScript
20 lines
683 B
TypeScript
import { RatingsInfo } from '../../commands/ratings';
|
|
import { Region } from '../../constants/regions';
|
|
import { context } from '../blitzkrieg/context';
|
|
import { patientFetch } from '../blitzkrieg/patientFetch';
|
|
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
|
|
|
export default async function getRatingsInfo(region: Region) {
|
|
const response = await patientFetch(
|
|
context === 'website'
|
|
? `/api/${region}/ratings/current/info`
|
|
: `https://${regionToRegionSubdomain(
|
|
region,
|
|
)}.wotblitz.com/en/api/rating-leaderboards/season/`,
|
|
undefined,
|
|
{ cache: 'no-store' },
|
|
);
|
|
|
|
return (await response.json()) as Promise<RatingsInfo>;
|
|
}
|