refactor(#27): Simplify appraisal

This commit is contained in:
Sirttas
2026-07-15 18:39:40 +02:00
parent 0d61826c70
commit 24c7ec4917
8 changed files with 14 additions and 136 deletions
+2 -3
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import {getMarketTypes, MarketTypePrice, useAppraisalStore} from "@/market";
import {getMarketTypes, getPrices, MarketTypePrice} from "@/market";
import {ref, watch} from 'vue';
import {ArrowPathIcon} from '@heroicons/vue/24/outline';
import {useAutoRefresh} from '@/composables';
@@ -20,7 +20,6 @@ const props = defineProps<Props>();
const buyModal = ref<typeof BuyModal>();
const sellModal = ref<typeof SellModal>();
const appraisalStore = useAppraisalStore();
const enriched = ref<AcquiredType[]>([]);
const refresh = async (itms: RawAcquiredType[] = props.items) => {
@@ -30,7 +29,7 @@ const refresh = async (itms: RawAcquiredType[] = props.items) => {
}
const types = await getMarketTypes([...new Set(itms.map(i => i.type))]);
const prices = await appraisalStore.getPrices(types);
const prices = await getPrices(types);
enriched.value = itms.map(i => {
const price = prices.find(p => p.type.id === i.type) as MarketTypePrice;