Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. asyncData(context) {
  2. // Check if we are in the editor mode
  3. let version =
  4. context.query._storyblok || context.isDev ? "draft" : "published";
  5.  
  6. return context.app.$storyapi
  7. .get(`cdn/stories/nyheder/${context.params.slug}`, {
  8. version
  9. })
  10. .then(res => {
  11. return res.data;
  12. })
  13. .catch(res => {
  14. context.error({
  15. statusCode: res.response.status,
  16. message: res.response.data
  17. });
  18. });
  19. },
  20. mounted() {
  21. this.$storybridge.on(["input", "published", "change"], event => {
  22. if (event.action == "input") {
  23. if (event.story.id === this.story.id) {
  24. this.story.content = event.story.content;
  25. }
  26. } else {
  27. window.location.reload();
  28. }
  29. });
  30. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement