mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
feat: removed non-proxy apis
This commit is contained in:
1 parent
925ac96264
commit
6ff2a23ff7
11 files changed
+54
-65
No files matched your search
@@ -1,11 +1,11 @@
|
||||
import { REGION_NAMES, Region } from '../../constants/regions';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import { TankStats } from '../../types/tanksStats';
|
||||
import { TanksStats } from '../../types/tanksStats';
|
||||
import throwError from '../node/throwError';
|
||||
import getWargamingResponse from './getWargamingResponse';
|
||||
|
||||
export default async function getTankStats(region: Region, id: number) {
|
||||
const tankStats = await getWargamingResponse<TankStats>(
|
||||
const tankStats = await getWargamingResponse<TanksStats>(
|
||||
`https://api.wotblitz.${region}/wotb/tanks/stats/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}`,
|
||||
);
|
||||
|
||||
|
||||
@@ -22,8 +22,12 @@ export interface Tankopedia {
|
||||
}
|
||||
|
||||
console.log('Caching tankopedia...');
|
||||
export const tankopedia = fetch('https://www.blitzstars.com/bs-tankopedia.json')
|
||||
.then((response) => response.json())
|
||||
export const tankopedia = fetch(
|
||||
typeof window === 'undefined'
|
||||
? 'https://www.blitzstars.com/bs-tankopedia.json'
|
||||
: '/api/tankopedia',
|
||||
)
|
||||
.then(async (response) => response.json())
|
||||
.then((wrapperTankopedia) => {
|
||||
console.log('Tankopedia cached');
|
||||
return (wrapperTankopedia as { data: Tankopedia }).data;
|
||||
|
||||
Reference in new issue
Block a user