bug: edit const

This commit is contained in:
Quangnhankie
2021-10-11 10:05:16 +07:00
parent 279c20e1af
commit 71475d66ec
2 changed files with 4 additions and 3 deletions

View File

@@ -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} />
})
}

View File

@@ -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
}
}