-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(home): add content from storyblok
- Loading branch information
1 parent
d2a19ce
commit 1096466
Showing
1 changed file
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |