Update requirement files with new feature templates and fix backend API error message, along with mobile project config updates and documentation improvements

This commit is contained in:
louiscklaw
2025-06-13 12:11:47 +08:00
parent f23a6b7d9c
commit 346992d4ec
3102 changed files with 220182 additions and 2896 deletions

View File

@@ -1,27 +1,22 @@
import { Store } from "pullstate";
import { Store } from 'pullstate';
const CartStore = new Store({
cart: []
cart: [],
});
export default CartStore;
export const addToCart = product => {
export const addToCart = (product) => {
const currentCart = CartStore.getRawState().cart;
const added = !currentCart.includes(product);
const currentCart = CartStore.getRawState().cart;
const added = !currentCart.includes(product);
CartStore.update((s) => {
if (currentCart.includes(product)) {
s.cart = currentCart.filter((current) => current !== product);
} else {
s.cart = [...s.cart, product];
}
});
CartStore.update(s => {
if (currentCart.includes(product)) {
s.cart = currentCart.filter(current => current !== product);
} else {
s.cart = [ ...s.cart, product ];
}
});
return added;
}
return added;
};