Skip to content

Commit

Permalink
Update CartItem.jsx
Browse files Browse the repository at this point in the history
fix code
  • Loading branch information
hocine1212 authored Oct 2, 2023
1 parent cf15e5e commit aa14af9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pages/cart/CartItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { useCart } from "@/util/context"
import Image from "next/image"

function CartItem({ item, onRemove, onIncrease, onDecrease }) {
const itemDocRef = doc(db, "items", item.id)
const itemId=item.id
const itemDocRef = doc(db, "items", itemId)

const handleIncrease = async () => {
onIncrease(
Expand All @@ -25,7 +26,7 @@ function CartItem({ item, onRemove, onIncrease, onDecrease }) {
}

const handleRemove = async () => {
onRemove(await deleteDoc(doc(db, "items", item.id)))
onRemove(await deleteDoc(doc(db, "items", itemId)))
}

return (
Expand Down

0 comments on commit aa14af9

Please sign in to comment.