Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- asyncData(context) {
- // Check if we are in the editor mode
- let version =
- context.query._storyblok || context.isDev ? "draft" : "published";
- return context.app.$storyapi
- .get(`cdn/stories/nyheder/${context.params.slug}`, {
- version
- })
- .then(res => {
- return res.data;
- })
- .catch(res => {
- context.error({
- statusCode: res.response.status,
- message: res.response.data
- });
- });
- },
- mounted() {
- this.$storybridge.on(["input", "published", "change"], event => {
- if (event.action == "input") {
- if (event.story.id === this.story.id) {
- this.story.content = event.story.content;
- }
- } else {
- window.location.reload();
- }
- });
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement