From 62a31ccb588c45e6a6a53785e05f939eb41f4818 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Sun, 10 Jan 2021 11:46:08 +0100 Subject: Fix parsing posts --- lib/generateApi.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/generateApi.ts b/lib/generateApi.ts index c8b20ce..3019d3c 100644 --- a/lib/generateApi.ts +++ b/lib/generateApi.ts @@ -77,12 +77,12 @@ function generateApiIndex(posts: Array, path: string) { * This function generates pages on path `/api/page/` */ function generatePages(posts: Array, path: string, len: number = 8) { - const parsedPosts = posts.map(parsePosts); const pages = chunk(posts, len); mkDirByPathSync(`${path}/api/page`); pages.forEach((posts: Array, index: number) => { + const parsedPosts = posts.map(parsePosts); const pageNumber = index + 1; - const page = { posts, next : pageNumber + 1 }; + const page = { posts: parsedPosts, next : pageNumber + 1 }; if (pageNumber == pages.length) { delete page.next; } -- cgit 1.4.1