From 1126030abc2775fec7d0aa1786224071514314f2 Mon Sep 17 00:00:00 2001 From: Quangnhankie Date: Sun, 10 Oct 2021 14:45:44 +0700 Subject: [PATCH] feat: edit activeCustomer --- .../vendure/utils/queries/active-customer-query.ts | 7 +++++++ next-env.d.ts | 3 --- src/components/common/ItemWishList/ItemWishList.tsx | 10 ++++++++-- src/components/common/ProductCard/ProductCard.tsx | 4 +++- src/components/common/ProductList/ProductList.tsx | 2 ++ 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/framework/vendure/utils/queries/active-customer-query.ts b/framework/vendure/utils/queries/active-customer-query.ts index 65b280743..014ea130e 100644 --- a/framework/vendure/utils/queries/active-customer-query.ts +++ b/framework/vendure/utils/queries/active-customer-query.ts @@ -5,6 +5,13 @@ export const activeCustomerQuery = /* GraphQL */ ` firstName lastName emailAddress + favorites{ + items{ + product{ + id + } + } + } } } ` diff --git a/next-env.d.ts b/next-env.d.ts index 9bc3dd46b..c6643fda1 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,3 @@ /// /// /// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/src/components/common/ItemWishList/ItemWishList.tsx b/src/components/common/ItemWishList/ItemWishList.tsx index 74d0b3b04..f8be07cd4 100644 --- a/src/components/common/ItemWishList/ItemWishList.tsx +++ b/src/components/common/ItemWishList/ItemWishList.tsx @@ -4,16 +4,22 @@ import React, { memo } from 'react' import s from './ItemWishList.module.scss' interface Props { + id:string, isActive?: boolean, - onChange?: () => void + onChange?: () => string } -const ItemWishList = memo(({isActive=false, onChange}:Props) => { +const ItemWishList = memo(({id,isActive=false, onChange}:Props) => { + // function toggleFavorite(id:string):string|undefined{ + // // alert(id); + // return id; + // } return(
diff --git a/src/components/common/ProductCard/ProductCard.tsx b/src/components/common/ProductCard/ProductCard.tsx index 4761aac92..50df7695f 100644 --- a/src/components/common/ProductCard/ProductCard.tsx +++ b/src/components/common/ProductCard/ProductCard.tsx @@ -17,6 +17,7 @@ export interface ProductCardProps extends ProductCard { } const ProductCardComponent = ({ + id, collection, name, slug, @@ -34,6 +35,7 @@ const ProductCardComponent = ({
} + return (
@@ -63,7 +65,7 @@ const ProductCardComponent = ({
{price} {currencyCode}
- +
diff --git a/src/components/common/ProductList/ProductList.tsx b/src/components/common/ProductList/ProductList.tsx index c901b4d46..5c3d9058a 100644 --- a/src/components/common/ProductList/ProductList.tsx +++ b/src/components/common/ProductList/ProductList.tsx @@ -33,6 +33,8 @@ const ProductList = ({ data, total = data.length, defaultCurrentPage, onPageChan
{ data.map((product, index) => { + console.log(product); + return }) }