diff --git a/lib/bigcommerce/api/cart/index.ts b/lib/bigcommerce/api/cart/index.ts index f2f174b84..4f6062674 100644 --- a/lib/bigcommerce/api/cart/index.ts +++ b/lib/bigcommerce/api/cart/index.ts @@ -80,19 +80,19 @@ const cartApi: BigcommerceApiHandler = async ( // Create or add an item to the cart if (req.method === 'POST') { - const body = { cartId, ...req.body } + const body = { ...req.body, cartId } return await handlers['addItem']({ req, res, config, body }) } // Update item in cart if (req.method === 'PUT') { - const body = { cartId, ...req.body } + const body = { ...req.body, cartId } return await handlers['updateItem']({ req, res, config, body }) } // Remove an item from the cart if (req.method === 'DELETE') { - const body = { cartId, ...req.body } + const body = { ...req.body, cartId } return await handlers['removeItem']({ req, res, config, body }) } } catch (error) { diff --git a/lib/bigcommerce/api/customers/index.ts b/lib/bigcommerce/api/customers/index.ts index c39f55f6a..a626ef2c7 100644 --- a/lib/bigcommerce/api/customers/index.ts +++ b/lib/bigcommerce/api/customers/index.ts @@ -38,7 +38,7 @@ const customersApi: BigcommerceApiHandler = async ( try { if (req.method === 'POST') { - const body = { cartId, ...req.body } + const body = { ...req.body, cartId } return await handlers['createCustomer']({ req, res, config, body }) } } catch (error) { diff --git a/lib/bigcommerce/api/wishlist/index.ts b/lib/bigcommerce/api/wishlist/index.ts index 912d59491..7ab8c9173 100644 --- a/lib/bigcommerce/api/wishlist/index.ts +++ b/lib/bigcommerce/api/wishlist/index.ts @@ -47,7 +47,7 @@ export type Wishlist = { export type WishlistList = Wishlist[] export type WishlistHandlers = { - getAllWishlists: BigcommerceHandler + getAllWishlists: BigcommerceHandler getWishlist: BigcommerceHandler addWishlist: BigcommerceHandler< Wishlist, @@ -57,7 +57,10 @@ export type WishlistHandlers = { Wishlist, { wishlistId: string } & Body > - addItem: BigcommerceHandler> + addItem: BigcommerceHandler< + Wishlist, + { wishlistId: string } & Body + > removeItem: BigcommerceHandler< Wishlist, { wishlistId: string } & Body @@ -86,13 +89,13 @@ const wishlistApi: BigcommerceApiHandler = 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 }) } diff --git a/lib/commerce/api/index.ts b/lib/commerce/api/index.ts index 6c4bf0544..38ed70d4a 100644 --- a/lib/commerce/api/index.ts +++ b/lib/commerce/api/index.ts @@ -14,8 +14,4 @@ export interface CommerceAPIFetchOptions { preview?: boolean } -// TODO: define interfaces for all the available operations - -// export interface CommerceAPI { -// getAllProducts(options?: { query: string }): Promise; -// } +// TODO: define interfaces for all the available operations and API endpoints