|
|
@ -67,20 +67,25 @@ function Book({ |
|
|
|
|
|
|
|
|
|
|
|
const physicalAvailabileInCart = React.useMemo(() => { |
|
|
|
const physicalAvailabileInCart = React.useMemo(() => { |
|
|
|
return userProducts?.filter( |
|
|
|
return userProducts?.filter( |
|
|
|
(product) => product?.productId === physicalProduct?.id |
|
|
|
(product) => |
|
|
|
)[0]; |
|
|
|
product?.productId === physicalProduct?.id && product?.condition < 2 |
|
|
|
|
|
|
|
)?.length; |
|
|
|
}, [userProducts, book]); |
|
|
|
}, [userProducts, book]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(physicalAvailabileInCart); |
|
|
|
|
|
|
|
|
|
|
|
const digitalAvailabileInCart = React.useMemo(() => { |
|
|
|
const digitalAvailabileInCart = React.useMemo(() => { |
|
|
|
return userProducts?.filter( |
|
|
|
return userProducts?.filter( |
|
|
|
(product) => product?.productId === digitalProduct?.id |
|
|
|
(product) => |
|
|
|
)[0]; |
|
|
|
product?.productId === digitalProduct?.id && product?.condition < 2 |
|
|
|
|
|
|
|
)?.length; |
|
|
|
}, [userProducts, book]); |
|
|
|
}, [userProducts, book]); |
|
|
|
|
|
|
|
|
|
|
|
const videoAvailabileInCart = React.useMemo(() => { |
|
|
|
const videoAvailabileInCart = React.useMemo(() => { |
|
|
|
return userProducts?.filter( |
|
|
|
return userProducts?.filter( |
|
|
|
(product) => product?.productId === videoProduct?.id |
|
|
|
(product) => |
|
|
|
)[0]; |
|
|
|
product?.productId === videoProduct?.id && product?.condition < 2 |
|
|
|
|
|
|
|
)?.length; |
|
|
|
}, [userProducts, book]); |
|
|
|
}, [userProducts, book]); |
|
|
|
|
|
|
|
|
|
|
|
const addToCart = React.useCallback( |
|
|
|
const addToCart = React.useCallback( |
|
|
|