Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- <section class="util__container">
- <component v-if="story.content.component" :key="story.content._uid" :blok="story.content" :is="story.content.component"></component>
- </section>
- </template>
- <script>
- export default {
- data () {
- return { story: { content: {} } }
- },
- mounted () {
- this.$storyblok.init()
- this.$storyblok.on(['change', 'published'], () => {
- location.reload(true)
- })
- },
- asyncData (context) {
- // Check if we are in the editor mode
- let version = context.query._storyblok || context.isDev ? 'draft' : 'published'
- // Load the JSON from the API
- return context.app.$storyapi.get(`cdn/stories/${context.params.language}/home`, {
- version: version,
- cv: context.store.state.cacheVersion
- }).then((res) => {
- return res.data
- }).catch((res) => {
- context.error({ statusCode: res.response.status, message: res.response.data })
- })
- }
- }
- </script>
Add Comment
Please, Sign In to add comment