versione 1.2.14 :

- aggiornati i file di configurazione, ENV e script non funzionanti., package.
- corretto custom-service-worker.js con CORS
- ottimizzato il server, la chiamata Load iniziale (senza promise, con async/await).
This commit is contained in:
Surya Paolo
2025-03-12 21:03:02 +01:00
parent d106a59bb5
commit 7827e49760
19 changed files with 594 additions and 1549 deletions

View File

@@ -181,25 +181,24 @@ router.put('/:userId', authenticate, async function (req, res, next) {
const cart = await Cart.getCartByUserId(userId);
try {
const p = await Product.getProductByID(productId);
const myprod = await Product.getProductByID(productId);
let newCart = oldCart.add(p, productId, { color, size })
let newCart = oldCart.add(myprod, productId, { color, size })
//exist cart in databse
if (cart.length > 0) {
await Cart.updateCartByUserId(
userId,
{
try {
const result = await Cart.updateCartByUserId(userId, {
items: newCart.items,
totalQty: newCart.totalQty,
totalPrice: newCart.totalPrice,
totalPriceCalc: newCart.totalPriceCalc,
userId: userId
},
function (err, result) {
if (err) return next(err)
res.json(result)
})
});
res.json(result);
} catch (err) {
return next(err);
}
} else {
//no cart in database
let newCartobj = {
@@ -242,7 +241,7 @@ router.post('/:userId/createorderscart', authenticate, async function (req, res,
let idapp = req.body.idapp;
let cart_id = req.body.cart_id;
let userId = req.params.userId;
const user = req.user;
let status = req.body.status;
let note = req.body.note;
let options = req.body.options;