UNPKG

@thunderstorefront/api-mock

Version:

Create Nuxt extendable layer with this GitHub template.

9 lines (7 loc) 298 B
import { cart } from '../../data/cart'; export default defineEventHandler(async (event) => { const body = await readBody<{ cartId: string; itemId: string }>(event); cart.items = cart.items.filter((item) => item.id !== body.itemId); cart.totalQuantity = cart.items.length; return cart; });