mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: more imports 2
This commit is contained in:
1 parent
4f24db0956
commit
c51ddbc725
49 files changed
+138
-123
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { RatingNeighbors, Region } from '@blitzkit/core';
|
||||
import { regionToRegionSubdomain } from '../../../website/src/core/blitz/regionToRegionSubdomain';
|
||||
import { patientFetch } from '../../../website/src/core/blitzkit/patientFetch';
|
||||
import { withCORSProxy } from '../../../website/src/core/blitzkit/withCORSProxy';
|
||||
|
||||
export async function getRatingNeighbors(
|
||||
region: Region,
|
||||
id: number,
|
||||
count: number,
|
||||
usePatientFetcher = false,
|
||||
) {
|
||||
const fetcher = (url: string) =>
|
||||
usePatientFetcher
|
||||
? patientFetch(url, undefined, { cache: 'no-store' })
|
||||
: fetch(url, { cache: 'no-store' });
|
||||
const response = await fetcher(
|
||||
withCORSProxy(
|
||||
`https://${regionToRegionSubdomain(
|
||||
region,
|
||||
)}.wotblitz.com/en/api/rating-leaderboards/user/${id}/?neighbors=${count}`,
|
||||
),
|
||||
);
|
||||
const json = (await response.json()) as RatingNeighbors;
|
||||
|
||||
return json;
|
||||
}
|
||||
Reference in new issue
Block a user