feat: /store api product types (#2552)
## What Allow users to fetch ProductTypes from the storefront API. ## Why This endpoint will allow developers to implement better faceted product search in Medusa without the need for search plugin. Developers will be able to use this to render refinement lists based on types, like this:  ## How Endpoint `GET /store/products/types` and `GET /store/product-types` (use [product types listing in admin](https://github.com/medusajs/medusa/blob/master/packages/medusa/src/api/routes/admin/products/list-types.ts) as reference) Support added in @medusajs/medusa-js Support added in medusa-react ## Testing Similar automated tests as `GET /admin/products/types` and `GET /admin/product-types` --- Resolves CORE-699
This commit is contained in:
@@ -55,11 +55,7 @@ describe("/admin/product-types", () => {
|
||||
it("returns a list of product types", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const res = await api
|
||||
.get("/admin/product-types", adminReqConfig)
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
const res = await api.get("/admin/product-types", adminReqConfig)
|
||||
|
||||
expect(res.status).toEqual(200)
|
||||
|
||||
@@ -74,11 +70,10 @@ describe("/admin/product-types", () => {
|
||||
it("returns a list of product types matching free text search param", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const res = await api
|
||||
.get("/admin/product-types?q=test-type-new", adminReqConfig)
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
const res = await api.get(
|
||||
"/admin/product-types?q=test-type-new",
|
||||
adminReqConfig
|
||||
)
|
||||
|
||||
expect(res.status).toEqual(200)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user