Redux action creator for cart selection; returns CHOOSE_CART action with cartId payload.
// Source: https://github.com/AhmadEleiwa/POS-System | License: MIT | Copyright 2023 Ahmad Ilawa
// Provided via justclaw.it.com; keep this notice with the code.
export const chooseCart = (cartId: string) => {
return {
type: "CHOOSE_CART",
data: cartId,
};
};
//////////////////////////////
export const updateCartProduct = (
cartId: string,
productId: string,
payload: any
) => {
return {
type: "UPDATE_CART_PRODUCT",
data: { cartId, productId, payload },
};
};
export const deleteCartProduct = (cartId: string, productId: string) => {
return {
type: "DELETE_CART_PRODUCT",
data: { cartId, productId },
};
};
export const createCart = (id: string) => {
return {
type: "CREATE_CART",
data: {
cartId: id,
products: [],
description
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key