about summary refs log tree commit diff
path: root/components/PostList/PostList.vue
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-12-01 14:11:51 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-12-01 14:11:51 +0100
commita28d5383f973e26da70b738f4a319083c45551af (patch)
tree9728836cc5e4aa7bba987659beb00eafeab856e4 /components/PostList/PostList.vue
parent47df6b13e0e4d40573534c57bbcc03e880782de5 (diff)
parent070b7725be5fb0db486e9370bea5648c16c8bbfe (diff)
downloadpuszcza-a28d5383f973e26da70b738f4a319083c45551af.tar.gz
puszcza-a28d5383f973e26da70b738f4a319083c45551af.zip
Merge remote-tracking branch 'origin/develop' into storybook
Diffstat (limited to 'components/PostList/PostList.vue')
-rw-r--r--components/PostList/PostList.vue15
1 files changed, 12 insertions, 3 deletions
diff --git a/components/PostList/PostList.vue b/components/PostList/PostList.vue
index 206a73f..2d1bb2d 100644
--- a/components/PostList/PostList.vue
+++ b/components/PostList/PostList.vue
@@ -1,8 +1,9 @@
 <template>
-  <pure-post-list :posts="posts" :loading="loading" />
+  <pure-post-list v-if="rawPosts" :posts="posts" :loading="loading" />
 </template>
 
 <script>
+import k from '~/api'
 import PurePostList from './PurePostList'
 
 export default {
@@ -14,6 +15,12 @@ export default {
       required: false
     }
   },
+  async asyncData() {
+    return {
+      loading: process.client,
+      rawPosts: process.client ? undefined : k.getPosts()
+    }
+  },
   data() {
     return {
       loading: true,
@@ -21,7 +28,9 @@ export default {
     }
   },
   mounted() {
-    this.loadPostsClient()
+    if (process.client && this.rawPosts === undefined) {
+      this.loadPostsClient()
+    }
   },
   computed: {
     posts() {
@@ -46,4 +55,4 @@ export default {
     }
   }
 }
-</script>
\ No newline at end of file
+</script>