From 56a6735bfd67d81cea90c97fd30bc8fac3791e7e Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Fri, 2 Aug 2019 15:31:37 +0300 Subject: [PATCH] api articles returns totalPages --- src/api/articles.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/articles.js b/src/api/articles.js index 88ebf709..98298a81 100644 --- a/src/api/articles.js +++ b/src/api/articles.js @@ -28,7 +28,7 @@ export async function findArticles(page, pageSize) { : [] const total = await Article.total() - const totalPages = total / pageSize + const totalPages = Math.ceil(total / pageSize) const id = i => i._id const pinnedIds = pinnedArticles.map(id) @@ -58,5 +58,6 @@ export async function findArticles(page, pageSize) { items, prevPage, nextPage, + totalPages, } } \ No newline at end of file