#Where is medusaRequest?

2 messages · Page 1 of 1 (latest)

normal ingot
#

I'm trying to add digital product capability. The examples in the docs for src/lib/data/index.ts use medusaRequest but I can't find it anywhere.

The full example is as follows:

import { 
  ProductMedia,
} from "types/product-media"
import { Variant } from "../../types/medusa"

// ... rest of the functions

export async function getProductMediaPreviewByVariant(
  variant: Variant
): Promise<ProductMedia> {
  const { 
    product_medias,
  } = await medusaRequest(
    "GET", 
    `/product-media`,
    {
      query: {
        variant_ids: variant.id,
      },
    }
  )
  .then((res) => res.body)
  .catch((err) => {
    throw err
  })

  return product_medias[0]
}

I'm guessing API has changed, so what's the current way to do this?

slim wagon
#

It was discussed 2 days ago, please find the thread and solve this.