@moonbase.sh/vue 0.1.78 → 0.1.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -3
- package/dist/index.js +6 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -335,9 +335,12 @@ function useCart() {
|
|
|
335
335
|
const _ = storefront.pushOrderContent();
|
|
336
336
|
},
|
|
337
337
|
setQuantity: (cartItem, quantity) => {
|
|
338
|
-
|
|
339
|
-
if (
|
|
340
|
-
|
|
338
|
+
const cartItemRef = storefront.currentOrder.value.items.find((i) => i.id === cartItem.id);
|
|
339
|
+
if (!cartItemRef)
|
|
340
|
+
throw new Error("Cart item not found");
|
|
341
|
+
cartItemRef.quantity = quantity;
|
|
342
|
+
if (cartItemRef.quantity <= 0) {
|
|
343
|
+
const index = storefront.currentOrder.value.items.findIndex((i) => i.id === cartItemRef.id);
|
|
341
344
|
storefront.currentOrder.value.items.splice(index, 1);
|
|
342
345
|
}
|
|
343
346
|
const _ = storefront.pushOrderContent();
|
package/dist/index.js
CHANGED
|
@@ -301,9 +301,12 @@ function useCart() {
|
|
|
301
301
|
const _ = storefront.pushOrderContent();
|
|
302
302
|
},
|
|
303
303
|
setQuantity: (cartItem, quantity) => {
|
|
304
|
-
|
|
305
|
-
if (
|
|
306
|
-
|
|
304
|
+
const cartItemRef = storefront.currentOrder.value.items.find((i) => i.id === cartItem.id);
|
|
305
|
+
if (!cartItemRef)
|
|
306
|
+
throw new Error("Cart item not found");
|
|
307
|
+
cartItemRef.quantity = quantity;
|
|
308
|
+
if (cartItemRef.quantity <= 0) {
|
|
309
|
+
const index = storefront.currentOrder.value.items.findIndex((i) => i.id === cartItemRef.id);
|
|
307
310
|
storefront.currentOrder.value.items.splice(index, 1);
|
|
308
311
|
}
|
|
309
312
|
const _ = storefront.pushOrderContent();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.79",
|
|
5
5
|
"description": "Package to let you build vue.js storefronts with Moonbase.sh as payment and delivery provider",
|
|
6
6
|
"author": "Tobias Lønnerød Madsen <m@dsen.tv>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@vue/devtools-api": "^6.5.1",
|
|
20
20
|
"uuid": "^9.0.1",
|
|
21
|
-
"@moonbase.sh/storefront-api": "0.1.
|
|
21
|
+
"@moonbase.sh/storefront-api": "0.1.79"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/uuid": "^9.0.7",
|