mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +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...');
|
||||
export const tankopedia = (
|
||||
(await (
|
||||
await fetch('https://www.blitzstars.com/bs-tankopedia.json')
|
||||
).json()) as WargamingResponse<Tankopedia> & { status: 'ok' }
|
||||
).data;
|
||||
console.log('Cached tankopedia');
|
||||
export const tankopedia: Tankopedia = {};
|
||||
fetch('https://www.blitzstars.com/bs-tankopedia.json')
|
||||
.then(
|
||||
(response) =>
|
||||
response.json() as Promise<
|
||||
WargamingResponse<Tankopedia> & { status: 'ok' }
|
||||
>,
|
||||
)
|
||||
.then((wargamingResponse) => {
|
||||
Object.assign(tankopedia, wargamingResponse.data);
|
||||
console.log('Cached tankopedia');
|
||||
});
|
||||
|
||||
export const TANK_ICONS: Record<TankType, string> = {
|
||||
'AT-SPG': 'https://i.imgur.com/BIHSEH0.png',
|
||||
|
||||
Reference in new issue
Block a user