disable remove product btn when click on the first time - issue #24

This commit is contained in:
Alexis Gousseau 2023-07-28 12:20:59 +02:00
parent b746b1e968
commit 110ec22dd7

View file

@ -38,7 +38,7 @@
</div>
</div>
</div>
<button class="btn icon-small icon-cross" @click="removeItem(item.cartItem.rowId)"></button>
<button class="btn icon-small icon-cross" @click="removeItem(item.cartItem.rowId)" :disabled="(disableBtn) ? true : false"></button>
</li>
</ul>
</section>
@ -79,12 +79,12 @@
},
data() {
return {
processing: false,
success:false,
errors:false,
showConfirmEmpty:false,
response: '',
promotion_slide: -1
promotion_slide: -1,
disableBtn: false,
}
},
mounted() {
@ -125,23 +125,24 @@
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la modification du panier.";
this.processing = false;
});
}
},
removeItem(rowId) {
this.disableBtn = true;
axios.post('/ajax/remove-from-cart', {
rowId: rowId,
instance: 'panier',
}).then(
(response) => {
this.updateStore(response.data);
this.disableBtn = false;
}
)
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la modification du panier.";
this.processing = false;
this.disableBtn = false;
});
},
emptyCart() {
@ -157,7 +158,6 @@
.catch(function (error) {
console.log(error);
this.response = "Erreur lors de la modification du panier.";
this.processing = false;
});
},
confirmEmpty() {