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-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/update-wishlist.ts
2020-10-19 09:10:45 -04:00

28 lines
562 B
TypeScript

import type { WishlistHandlers } from '..'
// Update wish info
const updateWishlist: WishlistHandlers['updateWishlist'] = async ({
res,
body: { wishlistId, wishlist },
config,
}) => {
if (!wishlistId || !wishlist) {
return res.status(400).json({
data: null,
errors: [{ message: 'Invalid request' }],
})
}
const { data } = await config.storeApiFetch(
`/v3/wishlists/${wishlistId}/`,
{
method: 'PUT',
body: JSON.stringify(wishlist),
}
)
res.status(200).json({ data })
}
export default updateWishlist