|
|
@@ -1,3 +1,4 @@
|
|
|
+import {cachedFetchJSON} from './cache';
|
|
|
import {setupPopover} from './popover';
|
|
|
|
|
|
const warehouseNames = {
|
|
|
@@ -210,15 +211,6 @@ async function getBids(username: string, apiKey: string, cx: string) {
|
|
|
return {bids, orders};
|
|
|
}
|
|
|
|
|
|
-const fetchCache = new Map<string, any>();
|
|
|
-async function cachedFetchJSON(url: string, options?: RequestInit): Promise<any> {
|
|
|
- if (fetchCache.has(url))
|
|
|
- return fetchCache.get(url);
|
|
|
- const response = await fetch(url, options).then((r) => r.json());
|
|
|
- fetchCache.set(url, response);
|
|
|
- return response;
|
|
|
-}
|
|
|
-
|
|
|
class Planet {
|
|
|
id: string;
|
|
|
name: string;
|