diff --git a/src/market/acquisition/acquisition.ts b/src/market/acquisition/acquisition.ts index 3116830..3f6cd05 100644 --- a/src/market/acquisition/acquisition.ts +++ b/src/market/acquisition/acquisition.ts @@ -36,9 +36,13 @@ export const useAcquiredTypesStore = defineStore('market-acquisition', () => { return; } + const item = { + ...found, + remaining: Math.max(0, found.remaining - quantity) + }; + if (found.remaining <= 0) { acquiredTypes.value = acquiredTypes.value.filter(i => i.type !== type); - } else { acquiredTypes.value = acquiredTypes.value.map(i => { if (i.type === item.type) { @@ -48,12 +52,6 @@ export const useAcquiredTypesStore = defineStore('market-acquisition', () => { } }); } - - const item = { - ...found, - remaining: found.remaining - quantity - }; - await marbasAxiosInstance.put(`${endpoint}${item.id}`, item); };