fix(medusa): return a single category instead of an array in retrieve category route (#7638)
* fix(medusa): return a single category instead of an array in retrieve category route * change to use refetchEntity
This commit is contained in:
@@ -4,19 +4,18 @@ import {
|
|||||||
AuthenticatedMedusaRequest,
|
AuthenticatedMedusaRequest,
|
||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
} from "../../../../types/routing"
|
} from "../../../../types/routing"
|
||||||
import { refetchEntities } from "../../../utils/refetch-entity"
|
import { refetchEntity } from "../../../utils/refetch-entity"
|
||||||
import { StoreProductCategoryParamsType } from "../validators"
|
import { StoreProductCategoryParamsType } from "../validators"
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest<StoreProductCategoryParamsType>,
|
req: AuthenticatedMedusaRequest<StoreProductCategoryParamsType>,
|
||||||
res: MedusaResponse<StoreProductCategoryResponse>
|
res: MedusaResponse<StoreProductCategoryResponse>
|
||||||
) => {
|
) => {
|
||||||
const category = await refetchEntities(
|
const category = await refetchEntity(
|
||||||
"product_category",
|
"product_category",
|
||||||
{ id: req.params.id, ...req.filterableFields },
|
req.params.id,
|
||||||
req.scope,
|
req.scope,
|
||||||
req.remoteQueryConfig.fields,
|
req.remoteQueryConfig.fields
|
||||||
req.remoteQueryConfig.pagination
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!category) {
|
if (!category) {
|
||||||
|
|||||||
Reference in New Issue
Block a user