From 85c4476915ee50a8ddd3b317950249f34df3d974 Mon Sep 17 00:00:00 2001 From: Sh Raj Date: Thu, 21 Mar 2024 05:49:37 +0000 Subject: [PATCH] op --- src/app/[slug]/page.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/[slug]/page.js b/src/app/[slug]/page.js index 2602160..b548d49 100644 --- a/src/app/[slug]/page.js +++ b/src/app/[slug]/page.js @@ -17,7 +17,7 @@ export default function ArticlesPage({ params }) { const [articles, setArticles] = useState([]); - const [page, setPage] = useState(0); + const [page, setPage] = useState(1); const [isLoading, setIsLoading] = useState(false); const [filteredArticles, setFilteredArticles] = useState([]); console.log(params.slug); @@ -26,8 +26,7 @@ export default function ArticlesPage({ params }) { setIsLoading(true); try { const response = await fetch( - // `https://dev.to/api/articles?username=${params.slug}&per_page=10&page=${page}` - `https://dev.to/api/articles/latest?username=${params.slug}` + `https://dev.to/api/articles?username=${params.slug}&per_page=100&page=${page}`,{ cache: 'no-store' } ); const data = await response.json(); setArticles((prevArticles) => [...prevArticles, ...data]);