daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Feb 17th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2.   <section class="util__container">
  3.     <component v-if="story.content.component" :key="story.content._uid" :blok="story.content" :is="story.content.component"></component>
  4.   </section>
  5. </template>
  6.  
  7. <script>
  8. export default {
  9.   data () {
  10.     return { story: { content: {} } }
  11.   },
  12.   mounted () {
  13.     this.$storyblok.init()
  14.     this.$storyblok.on(['change', 'published'], () => {
  15.       location.reload(true)
  16.     })
  17.   },
  18.   asyncData (context) {
  19.     // Check if we are in the editor mode
  20.     let version = context.query._storyblok || context.isDev ? 'draft' : 'published'
  21.  
  22.     // Load the JSON from the API
  23.     return context.app.$storyapi.get(`cdn/stories/${context.params.language}/home`, {
  24.       version: version,
  25.       cv: context.store.state.cacheVersion
  26.     }).then((res) => {
  27.       return res.data
  28.     }).catch((res) => {
  29.       context.error({ statusCode: res.response.status, message: res.response.data })
  30.     })
  31.   }
  32. }
  33. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top