fix: don't allow adding more units than stock to cart

This commit is contained in:
Tiago Vasconcelos 2023-03-17 11:22:56 +00:00
parent cf5d432998
commit 943a30f1e4

View file

@ -89,6 +89,14 @@ async function customerStall(path) {
let prod = this.cart.products
if (prod.has(item.id)) {
let qty = prod.get(item.id).quantity
if (qty == item.quantity) {
this.$q.notify({
type: 'warning',
message: `${item.name} only has ${item.quantity} units!`,
icon: 'production_quantity_limits'
})
return
}
prod.set(item.id, {
...prod.get(item.id),
quantity: qty + 1