UNPKG

@thunderstorefront/api-mock

Version:

Create Nuxt extendable layer with this GitHub template.

17 lines (15 loc) 363 B
import { cart } from '../../data/cart'; export default defineEventHandler(async (event) => { const body = await readBody<{ cartId: string; itemId: string; quantity: number; }>(event); cart.items = cart.items.map((item) => { if (item.id === body.itemId) { item.quantity = body.quantity; } return item; }); return cart; });