feature/adds-admin-add-article #1
@@ -5,19 +5,20 @@ import { FileTextIcon } from 'lucide-react';
|
||||
|
||||
const PAGE_SIZE = 9;
|
||||
|
||||
interface HomeProps {
|
||||
searchParams: Promise<{ page?: string }>;
|
||||
}
|
||||
type HomeProps = {
|
||||
searchParams: Promise<{ page?: string; pageSize?: string }>;
|
||||
};
|
||||
|
||||
const Home = async ({ searchParams }: HomeProps) => {
|
||||
const { page: pageParam } = await searchParams;
|
||||
const { page: pageParam, pageSize: pageSizeParam } = await searchParams;
|
||||
const page = Math.max(1, Number(pageParam) || 1);
|
||||
const pageSize = Number(pageSizeParam) || PAGE_SIZE;
|
||||
|
||||
const {
|
||||
data: articles,
|
||||
totalPages,
|
||||
total,
|
||||
} = await getArticlesPaginated(page, PAGE_SIZE);
|
||||
} = await getArticlesPaginated(page, pageSize);
|
||||
|
||||
return (
|
||||
<div className='container mx-auto w-full flex-1 px-4 py-12 md:py-16'>
|
||||
|
||||
Reference in New Issue
Block a user