4
0
forked from crowetic/commerce
Files
assets
components
config
lib
bigcommerce
api
cart
catalog
customers
definitions
fragments
operations
utils
wishlist
handlers
add-item.ts
add-wishlist.ts
get-all-wishlists.ts
get-wishlist.ts
remove-item.ts
remove-wishlist.ts
update-wishlist.ts
index.ts
checkout.ts
index.ts
cart
products
scripts
wishlist
index.tsx
schema.d.ts
schema.graphql
use-customer.tsx
use-login.tsx
use-logout.tsx
use-price.tsx
use-signup.tsx
commerce
browser.ts
colors.ts
logger.ts
range-map.ts
to-pixels.ts
pages
public
utils
.gitignore
.prettierignore
README.md
codegen.json
global.d.ts
next-env.d.ts
next.config.js
package.json
postcss.config.js
tailwind.config.js
tsconfig.json
yarn.lock
commerce/lib/bigcommerce/api/wishlist/handlers/add-wishlist.ts
2020-10-19 09:10:45 -04:00

26 lines
539 B
TypeScript

import type { WishlistHandlers } from '..'
// Return current wishlist info
const addWishlist: WishlistHandlers['addWishlist'] = async ({
res,
body: { wishlist },
config,
}) => {
if (!wishlist) {
return res.status(400).json({
data: null,
errors: [{ message: 'Missing wishlist data' }],
})
}
const options = {
method: 'POST',
body: JSON.stringify(wishlist),
}
const { data } = await config.storeApiFetch(`/v3/wishlists/`, options)
res.status(200).json({ data })
}
export default addWishlist