mirror of
https://github.com/vercel/commerce.git
synced 2025-09-07 16:30:17 +00:00
Fix potential body bug
This commit is contained in:
@@ -47,7 +47,7 @@ export type Wishlist = {
|
||||
export type WishlistList = Wishlist[]
|
||||
|
||||
export type WishlistHandlers = {
|
||||
getAllWishlists: BigcommerceHandler<WishlistList, { customerId?: string }>
|
||||
getAllWishlists: BigcommerceHandler<WishlistList, { customerId?: string }>
|
||||
getWishlist: BigcommerceHandler<Wishlist, { wishlistId?: string }>
|
||||
addWishlist: BigcommerceHandler<
|
||||
Wishlist,
|
||||
@@ -57,7 +57,10 @@ export type WishlistHandlers = {
|
||||
Wishlist,
|
||||
{ wishlistId: string } & Body<AddWishlistBody>
|
||||
>
|
||||
addItem: BigcommerceHandler<Wishlist, { wishlistId: string } & Body<AddItemBody>>
|
||||
addItem: BigcommerceHandler<
|
||||
Wishlist,
|
||||
{ wishlistId: string } & Body<AddItemBody>
|
||||
>
|
||||
removeItem: BigcommerceHandler<
|
||||
Wishlist,
|
||||
{ wishlistId: string } & Body<RemoveItemBody>
|
||||
@@ -86,13 +89,13 @@ const wishlistApi: BigcommerceApiHandler<Wishlist, WishlistHandlers> = async (
|
||||
|
||||
// Add an item to the wishlist
|
||||
if (req.method === 'POST' && wishlistId) {
|
||||
const body = { wishlistId, ...req.body }
|
||||
const body = { ...req.body, wishlistId }
|
||||
return await handlers['addItem']({ req, res, config, body })
|
||||
}
|
||||
|
||||
// Update a wishlist
|
||||
if (req.method === 'PUT' && wishlistId) {
|
||||
const body = { wishlistId, ...req.body }
|
||||
const body = { ...req.body, wishlistId }
|
||||
return await handlers['updateWishlist']({ req, res, config, body })
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user