0.0.32 • Published 1 year ago

nuxt-storyblok v0.0.32

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Nuxt Storyblok Package

This package exists primarily because of the setTimeout() throttle that exists in the official Storyblok package and which causes a stack overflow. It acts as a replacement of the official package and manages per-process memory cache of all responses.

We also use an express proxy instead of direct calls to handle caching and possibly live in case Storyblok goes down.

A low cache TTL is used because all content is actually always looked up via Storyblok's CDN (Cloudfront). Using a low TTL also removes the need for cleaning the cache on publish. Let clients know that there can be a delay up to cacheTTL seconds after publishing content to production.

Because we unlike the official repository don't want to modify axios behaviour, all parameters have to be passed a params to the second argument of get()

The official library:

this.$storyapi.get('cdn/stories', {
    version: 'draft',
    starts_with: 'news/'
  }).then((res) => {
    console.log(res.data.stories)
  })

Our library:

this.$storyapi.get('cdn/stories', {
    params: {
      starts_with: 'news/'
    }
  }).then((res) => {
    console.log(res.data.stories)
  })
  1. The version parameter has been removed. The configuration supports this and thus removes the need for specifying it for every call.
  2. There is a key params that indicates we want to send parameters.

Enable this module in your project by adding it to your nuxt.config.js:

modules: [
  // ...
  // ... other modules exist here as well
  // ...
  [
    "@madepeople/nuxt-storyblok",
    {
      // 'draft' or 'published', limited by the token
      version: "published",

      // Which token to use, from your storyblok account under Settings / API Keys
      token: "",
    }
  ],
],

See the module.js file for all options and their explanations.

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

1 year ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.25

2 years ago

0.0.26

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

1.0.13

3 years ago