fix(refill): stabilize stock and amount package semantics

This commit is contained in:
Daniel Volz
2026-05-08 11:03:25 +02:00
parent b838f0e8ea
commit 277fc3e686
23 changed files with 1696 additions and 335 deletions
+7 -1
View File
@@ -121,7 +121,12 @@ export function useRefill(): UseRefillReturn {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "include",
body: JSON.stringify({ packsAdded: refillPacks, loosePillsAdded: refillLoose, usePrescription }),
body: JSON.stringify({
packsAdded: refillPacks,
loosePillsAdded: refillLoose,
quantityAdded: refillLoose,
usePrescription,
}),
});
if (res.ok) {
const data = await res.json();
@@ -267,6 +272,7 @@ export function useRefill(): UseRefillReturn {
// Keep packageAmountValue (ml per bottle) and update capacity base by bottle count.
patchBody.packCount = correctedLiquidBottleCount;
patchBody.totalPills = liquidStructuralMax;
patchBody.looseTablets = liquidStructuralMax;
} else if (!isAmountPackage) {
patchBody.looseTablets = finalLoosePills;
}