From 71475d66ec69a2370b7b94ed4840343e03c688ed Mon Sep 17 00:00:00 2001 From: Quangnhankie Date: Mon, 11 Oct 2021 10:05:16 +0700 Subject: [PATCH] bug: edit const --- src/components/common/ProductList/ProductList.tsx | 4 ++-- src/components/hooks/auth/useActiveCustomer.tsx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/common/ProductList/ProductList.tsx b/src/components/common/ProductList/ProductList.tsx index 041ccbf94..de9cb94d5 100644 --- a/src/components/common/ProductList/ProductList.tsx +++ b/src/components/common/ProductList/ProductList.tsx @@ -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
{ 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 }) } diff --git a/src/components/hooks/auth/useActiveCustomer.tsx b/src/components/hooks/auth/useActiveCustomer.tsx index 67aa798cf..a3d8ce34a 100644 --- a/src/components/hooks/auth/useActiveCustomer.tsx +++ b/src/components/hooks/auth/useActiveCustomer.tsx @@ -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 } }