docs: rename data to event in subscribers across docs (#8149)
This commit is contained in:
+6
-6
@@ -14,19 +14,19 @@ In your resource, such as a subscriber, resolve the Notification Module's main s
|
||||
|
||||
export const highlights = [
|
||||
["12", "notificationModuleService", "Resolve the Notification Module."],
|
||||
["17", "create", "Create the notification to be sent."],
|
||||
["15", "create", "Create the notification to be sent."],
|
||||
[
|
||||
"19",
|
||||
"17",
|
||||
'"email"',
|
||||
"Use the module provider defined for the `email` channel to send an email.",
|
||||
],
|
||||
[
|
||||
"20",
|
||||
"18",
|
||||
'"product-created"',
|
||||
"The ID of the template defined in the third-party service, such as SendGrid.",
|
||||
],
|
||||
[
|
||||
"21",
|
||||
"19",
|
||||
"data",
|
||||
"The data to pass to the template defined in the third-party service.",
|
||||
],
|
||||
@@ -41,7 +41,7 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { INotificationModuleService } from "@medusajs/types"
|
||||
|
||||
export default async function productCreateHandler({
|
||||
data,
|
||||
event: { data },
|
||||
container,
|
||||
}: SubscriberArgs<{ id: string }>) {
|
||||
const notificationModuleService: INotificationModuleService =
|
||||
@@ -51,7 +51,7 @@ export default async function productCreateHandler({
|
||||
to: "shahednasser@gmail.com",
|
||||
channel: "email",
|
||||
template: "product-created",
|
||||
data: data.data,
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -116,14 +116,14 @@ To test the module out, create a simple subscriber at `src/subscribers/product-c
|
||||
|
||||
export const highlights = [
|
||||
["12", "notificationModuleService", "Resolve the Notification Module."],
|
||||
["17", "create", "Create the notification to be sent."],
|
||||
["15", "create", "Create the notification to be sent."],
|
||||
[
|
||||
"19",
|
||||
"17",
|
||||
'"email"',
|
||||
"By specifying the `email` channel, SendGrid will be used to send the notification.",
|
||||
],
|
||||
["20", '"product-created"', "The ID of the template defined in SendGrid."],
|
||||
["21", "data", "The data to pass to the template defined in SendGrid."],
|
||||
["18", '"product-created"', "The ID of the template defined in SendGrid."],
|
||||
["19", "data", "The data to pass to the template defined in SendGrid."],
|
||||
]
|
||||
|
||||
```ts title="src/subscribers/product-created.ts" highlights={highlights} collapsibleLines="1-7" expandButtonLabel="Show Imports"
|
||||
@@ -135,7 +135,7 @@ import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { INotificationModuleService } from "@medusajs/types"
|
||||
|
||||
export default async function productCreateHandler({
|
||||
data,
|
||||
event: { data },
|
||||
container,
|
||||
}: SubscriberArgs<{ id: string }>) {
|
||||
const notificationModuleService: INotificationModuleService =
|
||||
@@ -145,7 +145,7 @@ export default async function productCreateHandler({
|
||||
to: "test@gmail.com",
|
||||
channel: "email",
|
||||
template: "product-created",
|
||||
data: data.data,
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user