File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ import { NuxtDeliveryClient } from '~deliveryclientruntime/NuxtDeliveryClient'
44// Default configuration
55let config = {
66 kenticokontent : {
7- projectId : ''
7+ projectId : '' ,
8+ globalQueryConfig : { }
89 }
910}
1011
@@ -38,8 +39,27 @@ declare module 'vuex/types/index' {
3839}
3940
4041const deliveryClientPlugin : Plugin = ( context , inject ) => {
41- const deliveryClient = new NuxtDeliveryClient ( config . kenticokontent ) ;
42+ var kcSourceHeader = { header : 'X-KC-SOURCE' , value : 'kentico-kontent-nuxt-module' } ;
4243
44+ if ( config . kenticokontent . globalQueryConfig ) {
45+ config . kenticokontent . globalQueryConfig = Object . assign ( { } , config . kenticokontent . globalQueryConfig , {
46+ customHeaders : [
47+ kcSourceHeader
48+ ]
49+ } ) ;
50+ }
51+ else {
52+ config . kenticokontent = Object . assign ( { } , config . kenticokontent , {
53+ globalQueryConfig : {
54+ customHeaders : [
55+ kcSourceHeader
56+ ]
57+ }
58+ } ) ;
59+ }
60+
61+ const deliveryClient = new NuxtDeliveryClient ( config . kenticokontent ) ;
62+
4363 inject ( 'deliveryclient' , deliveryClient )
4464}
4565
You can’t perform that action at this time.
0 commit comments