import React from 'react' import Link from 'next/link' import * as Icon from 'react-feather' import { useSelector, useDispatch } from 'react-redux' import { useToasts } from 'react-toast-notifications' import { useRouter } from 'next/router' import QtyForm from './QtyForm' const CartContent = () => { const router = useRouter() const { addToast } = useToasts() const dispatch = useDispatch() const cart = useSelector((state) => state.cart) const total = useSelector((state) => state.total) // console.log(cart) const removeItem = (pId) => { dispatch({ type: 'REMOVE_ITEM', id: pId }) addToast('Cart Removed Successfully', { appearance: 'error' }) } const reset = () => { dispatch({ type: 'RESET' }) addToast('Thanks for your order.', { appearance: 'success' }) router.push('/') } return ( <>
Product | Name | Unit Price | Quantity | Total |
---|---|---|---|---|
|
{crt.name} | ${crt.price} |
|
${(crt.quantity * crt.price).toFixed(2)}
{removeItem(crt.id)}}>
|
Empty |