mirror of
https://github.com/vercel/commerce.git
synced 2025-03-28 16:25:53 +00:00
24 lines
492 B
TypeScript
24 lines
492 B
TypeScript
import type { Wishlist, WishlistHandlers } from '..'
|
|
|
|
// Return all wishlists
|
|
const getAllWishlists: WishlistHandlers['getAllWishlists'] = async ({
|
|
res,
|
|
body: { customerId },
|
|
config,
|
|
}) => {
|
|
let result: { data?: Wishlist[] } = {}
|
|
|
|
try {
|
|
result = await config.storeApiFetch(
|
|
`/v3/wishlists/customer_id=${customerId}`
|
|
)
|
|
} catch (error) {
|
|
throw error
|
|
}
|
|
|
|
const data = (result.data ?? []) as any
|
|
res.status(200).json({ data })
|
|
}
|
|
|
|
export default getAllWishlists
|