4
0
forked from crowetic/commerce

add in initial wishlist api functions and hooks

This commit is contained in:
Jing Wang
2020-10-19 09:10:45 -04:00
parent c54ef9fc5c
commit ecafee8310
13 changed files with 478 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
import { BigcommerceApiError } from '../../utils/errors'
import type { Wishlist, WishlistHandlers } from '..'
// Return wishlist info
const getWishlist: WishlistHandlers['getWishlist'] = async ({
res,
body: { wishlistId },
config,
}) => {
let result: { data?: Wishlist } = {}
try {
result = await config.storeApiFetch(`/v3/wishlists/${wishlistId}`)
} catch (error) {
throw error
}
res.status(200).json({ data: result.data ?? null })
}
export default getWishlist