mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36: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 ProductList = ({ data, total = data.length, defaultCurrentPage, onPageChange }: ProductListProps) => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const {wishlist } = useActiveCustomer();
|
const {wishlistId } = useActiveCustomer();
|
||||||
|
|
||||||
const handlePageChange = (page: number) => {
|
const handlePageChange = (page: number) => {
|
||||||
onPageChange && onPageChange(page)
|
onPageChange && onPageChange(page)
|
||||||
@@ -35,7 +35,7 @@ const ProductList = ({ data, total = data.length, defaultCurrentPage, onPageChan
|
|||||||
<div className={s.list}>
|
<div className={s.list}>
|
||||||
{
|
{
|
||||||
data.map((product, index) => {
|
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} />
|
return <ProductCard activeWishlist={activeWishlist} {...product} key={index} />
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,8 @@ const useActiveCustomer = () => {
|
|||||||
phoneNumber: data?.activeCustomer?.phoneNumber,
|
phoneNumber: data?.activeCustomer?.phoneNumber,
|
||||||
address: data?.activeCustomer?.addresses?.[0]
|
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
|
...rest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user