This repository has been archived on 2025-07-07. You can view files and clone it, but cannot push or open issues or pull requests.
Files
eternos/frontend/style/app/api/cart/route.ts

20 lines
540 B
TypeScript

import { NextRequest, NextResponse } from 'next/server'
import { getCart, saveCart, clearCart, CartItem } from '@/lib/cartStorage'
export async function GET() {
const cart = getCart()
return NextResponse.json(cart)
}
export async function POST(request: NextRequest) {
const cartItems: CartItem[] = await request.json()
saveCart(cartItems)
return NextResponse.json({ message: 'Cart updated successfully' })
}
export async function DELETE() {
clearCart()
return NextResponse.json({ message: 'Cart cleared successfully' })
}