Skip to content

Commit b89541a

Browse files
committed
docs: Updated readme
1 parent eaabcc0 commit b89541a

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ When using a static generated deployment you may need to use the [items-feed](ht
8787
API calls can be "cached" (they will be stored in memory) client side via the "viaCache" method.
8888

8989
```javascript
90+
9091
const query = this.$deliveryClient.items().type('page');
9192
const cacheSeconds = 30;
9293
this.$deliveryClient.viaCache(query, cacheSeconds)
@@ -99,7 +100,7 @@ API calls can be "cached" (they will be stored in memory) client side via the "v
99100
If you need to customize the Kentico Kontent Delivery SDK by registering interceptors and changing global config, you have to create a nuxt plugin.
100101

101102
### nuxt.config.js
102-
```
103+
``` json
103104
{
104105
modules: [
105106
'kentico-kontent-nuxt-module',
@@ -112,7 +113,22 @@ If you need to customize the Kentico Kontent Delivery SDK by registering interce
112113
```
113114

114115
### plugins/kenticokontentNuxtModule.js
116+
117+
> Version 7.x.x
118+
119+
``` javascript
120+
export default function ({ store, $deliveryClient }) {
121+
$deliveryclient.deliveryClient.config.globalHeaders = (queryConfig) => {
122+
let headers = [];
123+
headers.push({header: 'Authorization', value: 'bearer ' + store.state.token });
124+
return headers;
125+
}
126+
}
115127
```
128+
129+
< Version 7
130+
131+
``` javascript
116132
export default function ({ store, $deliveryClient }) {
117133
$deliveryClient.config.globalHeaders = (queryConfig) => {
118134
let headers = [];
@@ -127,7 +143,35 @@ export default function ({ store, $deliveryClient }) {
127143
Type resolvers can also be registered by using a nuxt plugin:
128144

129145
### plugins/kenticokontentNuxtModule.js
146+
147+
> Version 7.x.x
148+
149+
``` javascript
150+
import { TypeResolver, ContentItem } from '@kentico/kontent-delivery';
151+
152+
class Page extends ContentItem {
153+
constructor() {
154+
super({
155+
richTextResolver: (item, context) => {
156+
// todo: implement
157+
},
158+
urlSlugResolver: (link, context) => {
159+
// todo: implement
160+
}
161+
});
162+
}
163+
}
164+
165+
export default function ({ store, app, $deliveryClient }) {
166+
$deliveryClient.deliveryClient.config.typeResolvers = [
167+
new TypeResolver('page', () => new Page())
168+
]
169+
}
130170
```
171+
172+
< Version 7
173+
174+
``` javascript
131175
import { TypeResolver, ContentItem } from '@kentico/kontent-delivery';
132176

133177
class Page extends ContentItem {

0 commit comments

Comments
 (0)