mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: non-blocking tankopedia caching
This commit is contained in:
1 parent
1e32da01ee
commit
a1a13df7ce
1 file changed
+12
-6
@@ -19,12 +19,18 @@ export interface Tankopedia {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('Caching tankopedia...');
|
console.log('Caching tankopedia...');
|
||||||
export const tankopedia = (
|
export const tankopedia: Tankopedia = {};
|
||||||
(await (
|
fetch('https://www.blitzstars.com/bs-tankopedia.json')
|
||||||
await fetch('https://www.blitzstars.com/bs-tankopedia.json')
|
.then(
|
||||||
).json()) as WargamingResponse<Tankopedia> & { status: 'ok' }
|
(response) =>
|
||||||
).data;
|
response.json() as Promise<
|
||||||
console.log('Cached tankopedia');
|
WargamingResponse<Tankopedia> & { status: 'ok' }
|
||||||
|
>,
|
||||||
|
)
|
||||||
|
.then((wargamingResponse) => {
|
||||||
|
Object.assign(tankopedia, wargamingResponse.data);
|
||||||
|
console.log('Cached tankopedia');
|
||||||
|
});
|
||||||
|
|
||||||
export const TANK_ICONS: Record<TankType, string> = {
|
export const TANK_ICONS: Record<TankType, string> = {
|
||||||
'AT-SPG': 'https://i.imgur.com/BIHSEH0.png',
|
'AT-SPG': 'https://i.imgur.com/BIHSEH0.png',
|
||||||
|
|||||||
Reference in new issue
Block a user