Merge branch 'fixbug-13/9/2021-datnguyen' of github.com:KieIO/grocery-vercel-commerce into fixbug-13/9/2021-datnguyen

This commit is contained in:
DatNguyen
2021-10-04 11:07:00 +07:00
parent 7765b21831
commit 4c6b8a39e8

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { useCartDrawer } from 'src/components/contexts'; import { useCartDrawer } from 'src/components/contexts';
import useGetActiveOrder from 'src/components/hooks/useGetActiveOrder';
import { PRODUCT_CART_DATA_TEST } from 'src/utils/demo-data'; import { PRODUCT_CART_DATA_TEST } from 'src/utils/demo-data';
import { DrawerCommon } from '..'; import { DrawerCommon } from '..';
import s from './CartDrawer.module.scss'; import s from './CartDrawer.module.scss';
@@ -14,9 +15,10 @@ interface Props {
const CartDrawer = ({ }: Props) => { const CartDrawer = ({ }: Props) => {
const { cartVisible, closeCartDrawer } = useCartDrawer() const { cartVisible, closeCartDrawer } = useCartDrawer()
const {order} = useGetActiveOrder()
return ( return (
<DrawerCommon <DrawerCommon
title={`Your cart (${PRODUCT_CART_DATA_TEST.length})`} title={`Your cart (${order?.totalQuantity})`}
visible={cartVisible} visible={cartVisible}
onClose={closeCartDrawer}> onClose={closeCartDrawer}>
<div className={s.cartDrawer}> <div className={s.cartDrawer}>