mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
feat: session tracker list
This commit is contained in:
1 parent
6ff2a23ff7
commit
8c041d4eef
6 files changed
+145
-29
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { deburr } from 'lodash';
|
||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||
import { context } from '../blitzkrieg/context';
|
||||
import getWargamingResponse from './getWargamingResponse';
|
||||
|
||||
export type TankType = 'AT-SPG' | 'lightTank' | 'mediumTank' | 'heavyTank';
|
||||
@@ -23,14 +24,16 @@ export interface Tankopedia {
|
||||
|
||||
console.log('Caching tankopedia...');
|
||||
export const tankopedia = fetch(
|
||||
typeof window === 'undefined'
|
||||
context === 'bot'
|
||||
? '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;
|
||||
return context === 'bot'
|
||||
? (wrapperTankopedia as { data: Tankopedia }).data
|
||||
: (wrapperTankopedia as Tankopedia);
|
||||
});
|
||||
const entries = new Promise<TankopediaEntry[]>(async (resolve) => {
|
||||
resolve(Object.entries(await tankopedia).map(([, entry]) => entry));
|
||||
|
||||
Reference in new issue
Block a user