Refactor some code to make it looks cleaner

This commit is contained in:
PrinOrange
2023-12-29 19:55:54 +08:00
parent 643d528816
commit aa94563763
22 changed files with 87 additions and 106 deletions

View File

@@ -100,9 +100,8 @@ export const getStaticProps: GetStaticProps<PostsPageProps> = async (context) =>
const params = (context.params?.slug as string[]) ?? [];
const pageNumber = params[0] ? parseInt(params[0]) : 1;
let postList: TPostListItem[] = [];
postList = paginateArray(sortedPosts.allPostList, PostCountPerPagination, pageNumber);
let postList: TPostListItem[] = paginateArray(sortedPosts.allPostList, PostCountPerPagination, pageNumber);
const pageAmount = Math.ceil(sortedPosts.allPostList.length / PostCountPerPagination);