mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
25 lines
742 B
TypeScript
25 lines
742 B
TypeScript
import PostList from '@/app/(pages)/blog/PostList';
|
|
import Pagination from '@/app/(pages)/blog/Pagination';
|
|
import { fetchNocturneApi } from '@/app/(pages)/blog/api';
|
|
|
|
async function Blog({
|
|
searchParams
|
|
}: {
|
|
searchParams: Promise<{ [key: string]: string | string[] | undefined }>
|
|
}) {
|
|
|
|
const parsePage = Number((await searchParams)?.page);
|
|
const currPage = parsePage > 0 ? parsePage : 1;
|
|
const ret = await fetchNocturneApi(`/blog/get_page_count`);
|
|
const pageCount = (await ret.json() as any)['res'] as number;
|
|
|
|
return (
|
|
<div className={ 'w-full min-w-full space-y-4' }>
|
|
<PostList page={ currPage } />
|
|
<Pagination total={ pageCount } />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default Blog;
|