docs: replace ModuleRegistrationName with Modules (#9142)
This commit is contained in:
1 parent
8829f89402
commit
8584031041
55 files changed
+389
-391
No files matched your search
@@ -16,14 +16,14 @@ In this guide, you’ll find common examples of how you can use the Currency Mod
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICurrencyModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
res: MedusaResponse
|
||||
): Promise<void> {
|
||||
const currencyModuleService: ICurrencyModuleService = req.scope.resolve(
|
||||
ModuleRegistrationName.CURRENCY
|
||||
Modules.CURRENCY
|
||||
)
|
||||
|
||||
res.json({
|
||||
@@ -62,14 +62,14 @@ export async function GET(request: Request) {
|
||||
```ts
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICurrencyModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
res: MedusaResponse
|
||||
): Promise<void> {
|
||||
const currencyModuleService: ICurrencyModuleService = req.scope.resolve(
|
||||
ModuleRegistrationName.CURRENCY
|
||||
Modules.CURRENCY
|
||||
)
|
||||
|
||||
const currency = await currencyModuleService.retrieveCurrency("usd")
|
||||
|
||||
@@ -10,7 +10,7 @@ The Currency Module is the `@medusajs/currency` NPM package that provides curren
|
||||
|
||||
## How to Use Currency Module's Service
|
||||
|
||||
You can use the Currency Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.CURRENCY` imported from `@medusajs/utils`.
|
||||
You can use the Currency Module's main service by resolving from the Medusa container the resource `Modules.CURRENCY` imported from `@medusajs/utils`.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -20,14 +20,14 @@ For example:
|
||||
```ts title="src/api/store/custom/route.ts"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { ICurrencyModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
res: MedusaResponse
|
||||
): Promise<void> {
|
||||
const currencyModuleService: ICurrencyModuleService = req.scope.resolve(
|
||||
ModuleRegistrationName.CURRENCY
|
||||
Modules.CURRENCY
|
||||
)
|
||||
|
||||
res.json({
|
||||
@@ -42,11 +42,11 @@ export async function GET(
|
||||
```ts title="src/subscribers/custom-handler.ts"
|
||||
import { SubscriberArgs } from "@medusajs/medusa"
|
||||
import { ICurrencyModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
|
||||
export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
const currencyModuleService: ICurrencyModuleService = container.resolve(
|
||||
ModuleRegistrationName.CURRENCY
|
||||
Modules.CURRENCY
|
||||
)
|
||||
|
||||
const currencies = await currencyModuleService.listCurrencies()
|
||||
@@ -59,11 +59,11 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
```ts title="src/workflows/hello-world/step1.ts"
|
||||
import { createStep } from "@medusajs/workflows-sdk"
|
||||
import { ICurrencyModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
|
||||
const step1 = createStep("step-1", async (_, { container }) => {
|
||||
const currencyModuleService: ICurrencyModuleService = container.resolve(
|
||||
ModuleRegistrationName.CURRENCY
|
||||
Modules.CURRENCY
|
||||
)
|
||||
|
||||
const currencies = await currencyModuleService.listCurrencies()
|
||||
|
||||
Reference in new issue
Block a user