fix: pagination total pages

This commit is contained in:
Damillora 2021-05-10 09:47:19 +07:00
parent 9624a408b2
commit 5123bc8a24
2 changed files with 2 additions and 0 deletions

View File

@ -13,6 +13,7 @@
const data = await getPosts({page}); const data = await getPosts({page});
if(Array.isArray(data.posts)) { if(Array.isArray(data.posts)) {
posts = data.posts; posts = data.posts;
totalPages = data.totalPage;
} }
} }
onMount(() => { onMount(() => {

View File

@ -22,6 +22,7 @@
queryParams = queryString.parse(location.search); queryParams = queryString.parse(location.search);
if(queryParams.page) { if(queryParams.page) {
page = queryParams.page; page = queryParams.page;
totalPages = data.totalPage;
} }
getData(); getData();
}) })