File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ npm i rxjs --save (because this is a peer dependency of the Kentico Kontent Deli
2121- Add ` kentico-kontent-nuxt-module ` to ` modules ` section of ` nuxt.config.js `
2222
2323``` js
24-
2524 /*
2625 ** Nuxt.js modules
2726 */
@@ -32,7 +31,9 @@ npm i rxjs --save (because this is a peer dependency of the Kentico Kontent Deli
3231 projectId: ' xxxx-xxx-xxxx-xxxx-xxxxx' ,
3332 enableAdvancedLogging: false ,
3433 previewApiKey: ' xxxxxxxxxxxxxxxxxxxxxxxxxxx' ,
35- enablePreviewMode: true ,
34+ globalQueryConfig: {
35+ usePreviewMode: true , // Queries the Delivery Preview API.
36+ },
3637 baseUrl: ' https://custom.uri/api/KenticoKontentProxy' ,
3738 securedApiKey: ' xxx' ,
3839 enableSecuredMode: true
Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ module.exports = function kenticokontent (moduleOptions) {
55 projectId : process . env . KENTICOKONTENT_PROJECTID || '' ,
66 previewApiKey : process . env . KENTICOKONTENT_PREVIEWAPIKEY || null ,
77 enableAdvancedLogging : process . env . KENTICOKONTENT_ENABLEADVANCEDLOGGING || false ,
8- enablePreviewMode : process . env . KENTICOKONTENT_ENABLEPREVIEWMODE || false ,
8+ globalQueryConfig : {
9+ usePreviewMode : process . env . KENTICOKONTENT_ENABLEPREVIEWMODE || false
10+ } ,
911 defaultLanguage : process . env . KENTICOKONTENT_DEFAULTLANGUAGE || null ,
1012 retryAttempts : process . env . KENTICOKONTENT_RETRYATTEMPTS || null ,
1113 baseUrl : process . env . KENTICOKONTENT_BASEURL || null ,
Original file line number Diff line number Diff line change @@ -4,15 +4,17 @@ import CacheService from '../services/CacheService'
44export default ( ctx , inject ) => {
55 // Create new delivery client Instance
66 let settings = JSON . parse ( 'KENTICOOPTIONS' )
7+
8+ // Adds customHeaders if not already set
9+ if ( ! settings . globalQueryConfig . customHeaders )
10+ {
11+ settings . globalQueryConfig . customHeaders = [ ]
12+ }
713
8- // Add tracking header
9- settings = Object . assign ( { } , settings , {
10- globalQueryConfig : {
11- customHeaders : [
12- { header : 'X-KC-SOURCE' , value : 'kentico-kontent-nuxt-module' }
13- ]
14- }
15- } )
14+ // Adds X-KC-SOURCE to identify this module is in use
15+ settings . globalQueryConfig . customHeaders . push (
16+ { header : 'X-KC-SOURCE' , value : 'kentico-kontent-nuxt-module' }
17+ ) ;
1618
1719 const deliveryClient = new DeliveryClient ( settings )
1820
You can’t perform that action at this time.
0 commit comments