const postCache = require('./_postData'); const dateSort = (a, b) => new Date(b.date) - new Date(a.date); const mapComment = comment => { return ({ author: { name: comment.author_name, avatars: comment.author_avatar_urls, url: comment.author_url, }, content: comment.content.rendered, canonical: comment.meta.url, date: comment.date, }); } module.exports = async () => { // const cache = await postCache(); // const posts = Object.values(cache.posts) // .sort(dateSort) // .map(post => ({ // ...post, // comments: Object.values(post.comments) // .sort(dateSort) // .reduce((comments, comment) => { // if (!comments[comment.type]) { // comments[comment.type] = []; // } // comments[comment.type].push(mapComment(comment)); // return comments; // }, { like: [], reply: [], repost: [] }), // tags: post.tags.map(tag => ({ // name: cache.tags[tag].name, // slug: cache.tags[tag].slug, // link: cache.tags[tag].link // })) // })); // return posts; return []; };