- aggiornato carrello e bottoni sul catalogo
This commit is contained in:
@@ -2322,13 +2322,13 @@ export default defineComponent({
|
||||
router.push(path);
|
||||
}
|
||||
|
||||
function updateProducts(arr: any) {
|
||||
function updateProducts(arr: any, aggiorna?: boolean) {
|
||||
if (myCatalog.value) {
|
||||
if (
|
||||
myCatalog.value.lista_prodotti.length !== arr.length ||
|
||||
!myCatalog.value.lista_prodotti.every(
|
||||
(prod, index) => prod._id === arr[index]._id
|
||||
)
|
||||
) || aggiorna
|
||||
) {
|
||||
myCatalog.value.lista_prodotti = [...arr];
|
||||
|
||||
@@ -2352,7 +2352,7 @@ export default defineComponent({
|
||||
if (where === shared_consts.WHERE_INSERT.ONTOP) arr.unshift(element);
|
||||
else if (where === shared_consts.WHERE_INSERT.ONBOTTOM) arr.push(element);
|
||||
|
||||
updateProducts(arr);
|
||||
updateProducts(arr, true);
|
||||
|
||||
addnewProd.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user