about summary refs log tree commit diff
path: root/components/Posts
diff options
context:
space:
mode:
Diffstat (limited to 'components/Posts')
-rw-r--r--components/Posts/PostList/index.js15
1 files changed, 2 insertions, 13 deletions
diff --git a/components/Posts/PostList/index.js b/components/Posts/PostList/index.js
index 2b8ad92..dad805d 100644
--- a/components/Posts/PostList/index.js
+++ b/components/Posts/PostList/index.js
@@ -1,22 +1,11 @@
 import axios from 'axios'
 
-import k from '~/api'
+import { apiUrl, parsePosts } from '~/api'
 import PostList from './PostList'
 
 export const getPosts = async () => {
-  let posts = await axios.get(
-    `https://feature-json-api--puszcza.netlify.com/api/posts.json`
-  )
+  let posts = await axios.get(`${apiUrl}/posts.json`)
   return parsePosts(posts.data)
 }
 
-export const parsePosts = (posts) =>
-  posts.map((post) => ({
-    title: post.title,
-    image: post.image,
-    description: post.description,
-    route: post.path,
-    meta: post.meta,
-  }))
-
 export default PostList