diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2020-01-29 10:56:31 +0100 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2020-01-29 10:56:31 +0100 |
commit | 1c046bd96752feb1bbc0fb0e7b5fca94f299664a (patch) | |
tree | a2c5993f2c39846fef8e39c2496563edb1422c66 /components | |
parent | a46cabb3ed27fc099f0eb68c4b073fea6615e822 (diff) | |
download | puszcza-1c046bd96752feb1bbc0fb0e7b5fca94f299664a.tar.gz puszcza-1c046bd96752feb1bbc0fb0e7b5fca94f299664a.zip |
Add apiUrl
Diffstat (limited to 'components')
-rw-r--r-- | components/Posts/PostList/index.js | 15 |
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 |