modify slice to account for items with variants
This commit is contained in:
@@ -15,8 +15,8 @@ export default function CartActionsButtons({ item }: { item: CartItem }) {
|
||||
const isMobile = false; // Default to desktop
|
||||
const isRTL = false; // Default to LTR
|
||||
|
||||
const handleDeleteItem = (itemId: string) => {
|
||||
dispatch(removeItem(Number(itemId)));
|
||||
const handleDeleteItem = (uniqueId: string) => {
|
||||
dispatch(removeItem(uniqueId));
|
||||
};
|
||||
|
||||
const getPopconfirmOverlayStyle = () => ({
|
||||
@@ -49,7 +49,7 @@ export default function CartActionsButtons({ item }: { item: CartItem }) {
|
||||
type="text"
|
||||
size="small"
|
||||
onClick={() =>
|
||||
dispatch(updateQuantity({ id: item.id, quantity: Math.max(1, item.quantity - 1) }))
|
||||
dispatch(updateQuantity({ id: item.id, uniqueId: item.uniqueId || '', quantity: Math.max(1, item.quantity - 1) }))
|
||||
}
|
||||
className={styles.quantityButton}
|
||||
>
|
||||
@@ -59,7 +59,7 @@ export default function CartActionsButtons({ item }: { item: CartItem }) {
|
||||
<Popconfirm
|
||||
title={t("cart.deleteConfirmation.title")}
|
||||
description={t("cart.deleteConfirmation.content")}
|
||||
onConfirm={() => handleDeleteItem(item.id.toString())}
|
||||
onConfirm={() => handleDeleteItem(item.uniqueId || '')}
|
||||
okText={t("cart.deleteConfirmation.confirm")}
|
||||
cancelText={t("cart.deleteConfirmation.cancel")}
|
||||
okButtonProps={{ danger: true }}
|
||||
@@ -84,7 +84,7 @@ export default function CartActionsButtons({ item }: { item: CartItem }) {
|
||||
min={1}
|
||||
max={100}
|
||||
value={item.quantity || 1}
|
||||
onChange={(value) => dispatch(updateQuantity({ id: item.id, quantity: value || 1 }))}
|
||||
onChange={(value) => dispatch(updateQuantity({ id: item.id, uniqueId: item.uniqueId || '', quantity: value || 1 }))}
|
||||
size="small"
|
||||
controls={false}
|
||||
className={styles.quantityInput}
|
||||
@@ -94,7 +94,7 @@ export default function CartActionsButtons({ item }: { item: CartItem }) {
|
||||
type="text"
|
||||
size="small"
|
||||
onClick={() =>
|
||||
dispatch(updateQuantity({ id: item.id, quantity: Math.min(100, item.quantity + 1) }))
|
||||
dispatch(updateQuantity({ id: item.id, uniqueId: item.uniqueId || '', quantity: Math.min(100, item.quantity + 1) }))
|
||||
}
|
||||
className={styles.quantityButton}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user