webupdatev1
This commit is contained in:
@@ -182,7 +182,7 @@
|
||||
? product.description.substring(0, 100) + "..."
|
||||
: "");
|
||||
|
||||
const isInWishlist = window.AppState?.isInWishlist(id) || false;
|
||||
const isInWishlist = window.ShopSystem?.isInWishlist(id) || false;
|
||||
|
||||
return `
|
||||
<article class="product-card" data-id="${id}">
|
||||
@@ -228,7 +228,7 @@
|
||||
const id = parseInt(e.currentTarget.dataset.id);
|
||||
const product = this.products.find((p) => p.id === id);
|
||||
if (product) {
|
||||
window.AppState.addToCart(product);
|
||||
window.ShopSystem.addToCart(product, 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -242,10 +242,10 @@
|
||||
const id = parseInt(e.currentTarget.dataset.id);
|
||||
const product = this.products.find((p) => p.id === id);
|
||||
if (product) {
|
||||
if (window.AppState.isInWishlist(id)) {
|
||||
window.AppState.removeFromWishlist(id);
|
||||
if (window.ShopSystem.isInWishlist(id)) {
|
||||
window.ShopSystem.removeFromWishlist(id);
|
||||
} else {
|
||||
window.AppState.addToWishlist(product);
|
||||
window.ShopSystem.addToWishlist(product);
|
||||
}
|
||||
this.renderProducts(this.products);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user