1

以下是我们目前的配置。我们如何在不通过 storeConfig 的情况下配置、后端、身份验证、上下文?

B2cStorefrontModule.withConfig(environment.storeConfig), ConfigModule.withConfigFactory(defaultCmsContentConfig),

storeConfig: {
    backend: {
      occ: {
        baseUrl: 'https://localhost:9002',
        prefix: '/mywebservices/v2/'
      }
    },
    authentication: {
      client_id: 'myid',
      client_secret: 'mysecret'
    },

    context: {
      baseSite: ['mysite'],
      currency: ['USD'],
    },

    i18n: {
      resources: translations,
      chunks: translationChunksConfig,
      fallbackLang: 'en'

    }

  },
4

1 回答 1

1

您可以像这样导入并provideConfig使用@spartacus/core它:

@NgModule({
  ...
  imports: [ 
  ...
  provideConfig({
    // your config goes here
    backend: {
      occ: {
        baseUrl: 'https://localhost:9002',
        prefix: '/mywebservices/v2/'
      }
    },
    authentication: {
      client_id: 'myid',
      client_secret: 'mysecret'
    },
  }),
  ]
  ...
})

您可以拥有任意数量的provideConfig()

于 2019-11-21T02:48:57.730 回答