feat: proxy APIs

This commit is contained in:
TrèsAbhi committed 2023-11-11 21:37:59 -06:00
1 parent 7e4f195f94
commit 14bfc3018b
14 files changed
+130 -60

No files matched your search

+3 -2
View File
@@ -1,6 +1,5 @@
import { AllStats } from '../blitz/getAccountInfo';
import { context } from '../blitzkrieg/context';
import { withCORSProxy } from '../blitzkrieg/withCORSProxy';
import { tankopedia } from './tankopedia';
export interface SpecialStats {
@@ -86,7 +85,9 @@ tankopedia;
export type TankAverages = Record<number, IndividualTankAverage>;
export const tankAverages = fetch(
withCORSProxy('https://www.blitzstars.com/api/tankaverages.json'),
context === 'website'
? '/api/tank-averages'
: 'https://www.blitzstars.com/api/tankaverages.json',
)
.then((response) => response.json())
.then((json) => {
+3 -2
View File
@@ -1,6 +1,5 @@
import { deburr } from 'lodash';
import { context } from '../blitzkrieg/context';
import { withCORSProxy } from '../blitzkrieg/withCORSProxy';
export interface TankopediaEntry {
name: string;
@@ -19,7 +18,9 @@ export interface Tankopedia {
}
export const tankopedia = fetch(
withCORSProxy('https://www.blitzstars.com/bs-tankopedia.json'),
context === 'website'
? '/api/tankopedia'
: 'https://www.blitzstars.com/bs-tankopedia.json',
)
.then(async (response) => response.json())
.then((wrapperTankopedia) =>