mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
bug: edit const
This commit is contained in:
@@ -16,7 +16,7 @@ interface ProductListProps {
|
||||
|
||||
const ProductList = ({ data, total = data.length, defaultCurrentPage, onPageChange }: ProductListProps) => {
|
||||
const router = useRouter()
|
||||
const {wishlist } = useActiveCustomer();
|
||||
const {wishlistId } = useActiveCustomer();
|
||||
|
||||
const handlePageChange = (page: number) => {
|
||||
onPageChange && onPageChange(page)
|
||||
@@ -35,7 +35,7 @@ const ProductList = ({ data, total = data.length, defaultCurrentPage, onPageChan
|
||||
<div className={s.list}>
|
||||
{
|
||||
data.map((product, index) => {
|
||||
let activeWishlist = wishlist?.findIndex((val:string) => val == product.id) !== -1;
|
||||
let activeWishlist = wishlistId?.findIndex((val:string) => val == product.id) !== -1;
|
||||
return <ProductCard activeWishlist={activeWishlist} {...product} key={index} />
|
||||
})
|
||||
}
|
||||
|
@@ -15,7 +15,8 @@ const useActiveCustomer = () => {
|
||||
phoneNumber: data?.activeCustomer?.phoneNumber,
|
||||
address: data?.activeCustomer?.addresses?.[0]
|
||||
},
|
||||
wishlist: data?.activeCustomer?.favorites?.items.map((val:Favorite)=>val.product.id),
|
||||
itemWishlist:data?.activeCustomer?.favorites?.items,
|
||||
wishlistId: data?.activeCustomer?.favorites?.items.map((val:Favorite)=>val.product.id),
|
||||
...rest
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user