]> _ Git - fluidbook-html5.git/commitdiff
wait #4069 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 17 Nov 2020 12:14:18 +0000 (13:14 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 17 Nov 2020 12:14:18 +0000 (13:14 +0100)
js/libs/fluidbook/cart/fluidbook.cart.puma.js

index f526c2a1b7d9ab8cf7f55d95432cda56bca7c9e6..f92aa37f92cf750592a3f6cea5b45cfd053933a8 100644 (file)
@@ -1,5 +1,3 @@
-
-
 function FluidbookCartPuma(cart) {
     var $this = this;
     this.cart = cart;
@@ -32,13 +30,20 @@ FluidbookCartPuma.prototype = {
             this.save();
             return this.fluidbook.l10n.__("the item has been added to your cart");
         } else {
-            this.removeFromCart(ref);
+            this.removeFromCartByRef(ref);
             return this.fluidbook.l10n.__("the item has been removed from your cart");
         }
     },
 
-    removeFromCart: function (ref) {
+    removeFromCartByRef: function (ref) {
         var key = this.items.indexOf(ref);
+        if (key >= 0) {
+            this.removeFromCart(key)
+        }
+    },
+
+    removeFromCart: function (key) {
+        console.log(key);
         if (key >= 0) {
             this.items.splice(key, 1);
             this.save();