feat(medusa-react): Add Collection batch (remove, add) endpoints (#1959)

This commit is contained in:
Richard Ward
2022-08-08 12:58:23 +02:00
committed by GitHub
parent a88bf3c76e
commit 2a723dcd4f
4 changed files with 143 additions and 0 deletions
@@ -108,6 +108,29 @@ export const adminHandlers = [
)
}),
rest.post("/admin/collections/:id/products/batch", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
collection: {
...fixtures.get("product_collection"),
products: [fixtures.get("product")]
}
})
)
}),
rest.delete("/admin/collections/:id/products/batch", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
id: req.params.id,
object: "product-collection",
removed_products: [fixtures.get("product").id]
})
)
}),
rest.post("/admin/gift-cards/", (req, res, ctx) => {
const body = req.body as Record<string, any>
return res(