mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
feat: implemented most cart operations
This commit is contained in:
@@ -13,12 +13,11 @@ export default function DeleteItemButton({ item }: { item: CartItem }) {
|
||||
async function handleRemove() {
|
||||
setRemoving(true);
|
||||
|
||||
const response = await fetch(`/api/cart`, {
|
||||
method: 'DELETE',
|
||||
body: JSON.stringify({
|
||||
lineId: item.id
|
||||
})
|
||||
console.log(item.id);
|
||||
const response = await fetch(`/api/cart?lineId=${item.id}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.error) {
|
||||
|
@@ -107,7 +107,8 @@ export default function CartModal({
|
||||
height={64}
|
||||
alt={
|
||||
item.merchandise.product.featuredImage.altText ||
|
||||
item.merchandise.product.title
|
||||
item.merchandise.product.title ||
|
||||
''
|
||||
}
|
||||
src={item.merchandise.product.featuredImage.url}
|
||||
/>
|
||||
|
Reference in New Issue
Block a user