瀏覽代碼

docs: Correct execute function injector call (#3547)

Hen2609 8 月之前
父節點
當前提交
3c74d84dbc
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      docs/docs/guides/developer-guide/scheduled-tasks/index.md

+ 3 - 3
docs/docs/guides/developer-guide/scheduled-tasks/index.md

@@ -99,13 +99,13 @@ export const generateSitemapTask = new ScheduledTask({
     schedule: cron => cron.everyDayAt(0, 0),
     // This is the function that will be executed per the schedule.
     async execute({injector, params}) {
-        // Using `app.get()` we can grab an instance of _any_ provider defined in the
+        // Using `injector.get()` we can grab an instance of _any_ provider defined in the
         // Vendure core as well as by our plugins.
-        const sitemapService = app.get(SitemapService);
+        const sitemapService = injector.get(SitemapService);
 
         // For most service methods, we'll need to pass a RequestContext object.
         // We can use the RequestContextService to create one.
-        const ctx = await app.get(RequestContextService).create({
+        const ctx = await injector.get(RequestContextService).create({
             apiType: 'admin',
         });