about summary refs log tree commit diff
path: root/components/Posts/PostList/index.js
blob: 844f562b74c354a00d90622461aaa6e428769d72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import axios from 'axios'

import k from '~/api'
import PostList from './PostList'

export const getPosts = async () => {
  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.title,
    image: post.image,
    description: post.description,
    route: post.path,
    meta: post.meta,
  }))

export default PostList