cahce apraisal

This commit is contained in:
2023-09-23 10:56:17 +02:00
parent 1c882e0d1c
commit 14b2f01ef1
3 changed files with 42 additions and 11 deletions

View File

@@ -1,11 +1,13 @@
<script setup lang="ts">
import { MarketTypePrice, getMarketTypes, getPrices } from "@/market";
import { MarketTypePrice, getMarketTypes, useApraisalStore } from "@/market";
import { BuyModal, SellModal, TrackResultTable, TrackedItem, useTrackedItemStore } from '@/market/track';
import { ref, watch } from 'vue';
const buyModal = ref<typeof BuyModal>();
const sellModal = ref<typeof SellModal>();
const apraisalStore = useApraisalStore();
const trackedItemStore = useTrackedItemStore();
const items = ref<TrackedItem[]>([]);
@@ -14,7 +16,7 @@ watch(() => trackedItemStore.items.value, async itms => {
return;
}
const prices = await getPrices(await getMarketTypes(itms.map(i => i.typeID)));
const prices = await apraisalStore.getPrices(await getMarketTypes(itms.map(i => i.typeID)));
items.value = itms.map(i => {
const price = prices.find(p => p.type.id === i.typeID) as MarketTypePrice;