storyblok-js-client
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -15,7 +15,7 @@ 'use strict'; | ||
let headers = Object.assign({'X-Storyblok-Client': 'JS/1.0.0'}, config.headers); | ||
let headers = Object.assign({}, {'X-Storyblok-Client': 'JS/1.0.0'}, config.headers); | ||
this.cacheVersion = (this.cacheVersion || this.newVersion()); | ||
this.accessToken = config.accessToken; | ||
this.cache = config.cache || {}; | ||
this.cache = config.cache || {clear: 'manual'}; | ||
this.client = axios.create({ | ||
@@ -54,2 +54,6 @@ baseURL: endpoint, | ||
if (this.cache.clear === 'auto' && params.version === 'draft') { | ||
this.flushCache(); | ||
} | ||
if (params.version === 'published' && cache) { | ||
@@ -56,0 +60,0 @@ resolve(cache); |
{ | ||
"name": "storyblok-js-client", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Universal JavaScript SDK for Storyblok's API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -40,8 +40,9 @@ # Universal JavaScript SDK for Storyblok's API | ||
When initializing the Storyblok client you can define a cache provider for caching the requests in memory. | ||
To clear the cache you can call `Storyblok.flushCache();`. | ||
To clear the cache you can call `Storyblok.flushCache();` or activate the automatic clear with clear: 'auto'. | ||
```javascript | ||
let Storyblok = new StoryblokClient({ | ||
privateToken: 'xf5dRMMjltLzKOcNgMaU9Att', | ||
accessToken: 'xf5dRMMjltLzKOcNgMaU9Att', | ||
cache: { | ||
clear: 'auto', | ||
type: 'memory' | ||
@@ -48,0 +49,0 @@ } |
5619
106
89