From d0885eb9a0d9d6ff33a3203a693f72e9de4dc562 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Tue, 28 Jan 2020 20:02:14 +0100 Subject: Fix image --- components/Posts/PostList/PurePostList.vue | 2 +- components/Posts/PostList/index.js | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/components/Posts/PostList/PurePostList.vue b/components/Posts/PostList/PurePostList.vue index 210973e..cdbaffc 100644 --- a/components/Posts/PostList/PurePostList.vue +++ b/components/Posts/PostList/PurePostList.vue @@ -12,7 +12,7 @@ :route="post.route" :title="post.title" :description="post.description" - :image="post.image" + :image="post.meta.image" /> diff --git a/components/Posts/PostList/index.js b/components/Posts/PostList/index.js index 7e0b1f4..844f562 100644 --- a/components/Posts/PostList/index.js +++ b/components/Posts/PostList/index.js @@ -4,20 +4,17 @@ import k from '~/api' import PostList from './PostList' export const getPosts = async () => { - if (process.client) { - let posts = await axios.get(`${window.location.origin}/api/posts.json`) - return parsePosts(posts.data) - } else { - return parsePosts(k.getPosts()) - } + let posts = await axios.get(`https://puszcza.netlify.com/api/posts.json`) + return parsePosts(posts.data) } export const parsePosts = (posts) => posts.map((post) => ({ - title: post.content.meta.title, - image: post.content.meta.image, - description: post.content.description, - route: post.route, + title: post.title, + image: post.image, + description: post.description, + route: post.path, + meta: post.meta, })) export default PostList -- cgit 1.4.1