|
|
@@ -136,16 +136,16 @@ async function warehouseInventory(username: string, apiKey: string, whName: stri
|
|
|
const warehouses: Warehouse[] = await fetch('https://rest.fnar.net/sites/warehouses/' + username,
|
|
|
{headers: {'Authorization': apiKey}}).then(r => r.json());
|
|
|
|
|
|
+ const inventory = new Map<string, number>();
|
|
|
for (const warehouse of warehouses)
|
|
|
if (warehouse.LocationNaturalId === whName) {
|
|
|
const storage: Storage = await fetch(`https://rest.fnar.net/storage/${username}/${warehouse.StoreId}`,
|
|
|
{headers: {'Authorization': apiKey}}).then(r => r.json());
|
|
|
- const inventory = new Map<string, number>();
|
|
|
for (const item of storage.StorageItems)
|
|
|
inventory.set(item.MaterialTicker, item.MaterialAmount);
|
|
|
- return inventory;
|
|
|
+ break;
|
|
|
}
|
|
|
- throw new Error(`couldn't find ${whName} warehouse`);
|
|
|
+ return inventory;
|
|
|
}
|
|
|
|
|
|
async function getBids(username: string, apiKey: string, cx: string) {
|