Skip to content

Commit

Permalink
feat(home): add content from storyblok
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow81627 committed Dec 8, 2019
1 parent d2a19ce commit 1096466
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
<template>
<div class="xcontainer">
<hero
:blok="{
headline: 'Daim',
desciption: 'Innovative Marketing Technology Automation',
}"
></hero>
</div>
<section class="util__container">
<component
:is="story.content.component"
v-if="story.content.component"
:key="story.content._uid"
:blok="story.content"
></component>
</section>
</template>

<script>
import Hero from '~/components/hero.vue';
// import storyblokLivePreview from '@/mixins/storyblokLivePreview';
export default {
components: {
Hero,
// mixins: [storyblokLivePreview],
asyncData(context) {
// Check if we are in the editor mode
const version =
context.query._storyblok || context.isDev ? 'draft' : 'published';
// Load the JSON from the API
return context.app.$storyapi
.get('cdn/stories/home', {
version,
})
.then((res) => {
return res.data;
})
.catch((res) => {
context.error({
statusCode: res.response.status,
message: res.response.data,
});
});
},
data() {
return { story: { content: {} } };
},
};
</script>

0 comments on commit 1096466

Please sign in to comment.