mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-15 03:53:48 +00:00
fix(#51): Ensure the input for quantity is reactive
This commit is contained in:
@@ -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>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user