fix(#51): Ensure the input for quantity is reactive

This commit is contained in:
Josh Creek
2024-10-29 19:17:05 +00:00
parent 243dc883ac
commit f28f250fab
@@ -11,10 +11,11 @@
export let price = 0; export let price = 0;
export let quantity = 0; export let quantity = 0;
$: dispatch('changeQuantity', { itemId, quantity });
function reduceQuantityByOne() { function reduceQuantityByOne() {
if (quantity > 1) { if (quantity > 1) {
quantity--; quantity--;
dispatch('changeQuantity', { itemId, quantity });
} else { } else {
dispatch('removeItem', { itemId }); dispatch('removeItem', { itemId });
} }
@@ -22,7 +23,6 @@
function increaseQuantityByOne() { function increaseQuantityByOne() {
quantity++; quantity++;
dispatch('changeQuantity', { itemId, quantity });
} }
</script> </script>