diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2019-12-01 14:11:51 +0100 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2019-12-01 14:11:51 +0100 |
commit | a28d5383f973e26da70b738f4a319083c45551af (patch) | |
tree | 9728836cc5e4aa7bba987659beb00eafeab856e4 /components/PostList | |
parent | 47df6b13e0e4d40573534c57bbcc03e880782de5 (diff) | |
parent | 070b7725be5fb0db486e9370bea5648c16c8bbfe (diff) | |
download | puszcza-a28d5383f973e26da70b738f4a319083c45551af.tar.gz puszcza-a28d5383f973e26da70b738f4a319083c45551af.zip |
Merge remote-tracking branch 'origin/develop' into storybook
Diffstat (limited to 'components/PostList')
-rw-r--r-- | components/PostList/PostList.vue | 15 |
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> |