Fix remove acquisiton
This commit is contained in:
@@ -36,9 +36,13 @@ export const useAcquiredTypesStore = defineStore('market-acquisition', () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const item = {
|
||||||
|
...found,
|
||||||
|
remaining: Math.max(0, found.remaining - quantity)
|
||||||
|
};
|
||||||
|
|
||||||
if (found.remaining <= 0) {
|
if (found.remaining <= 0) {
|
||||||
acquiredTypes.value = acquiredTypes.value.filter(i => i.type !== type);
|
acquiredTypes.value = acquiredTypes.value.filter(i => i.type !== type);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
acquiredTypes.value = acquiredTypes.value.map(i => {
|
acquiredTypes.value = acquiredTypes.value.map(i => {
|
||||||
if (i.type === item.type) {
|
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);
|
await marbasAxiosInstance.put(`${endpoint}${item.id}`, item);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user