1- import { ArticlesPageComponents } from '@/components/ArticlesPageComponents'
21import { redirect } from 'next/navigation'
3- import { Article , getArticles , getCategories } from '../../../../../services/cms'
2+
3+ import { Article , Category , getArticles , getCategories } from '../../../../../services/cms'
4+
5+ import { ArticlesPageComponents } from '@/components/ArticlesPageComponents'
46import { ARTICLES_PER_PAGE } from '@/const/pagination'
57import { calculateTotalPages } from '@/util/paginationUtils'
68
@@ -17,6 +19,8 @@ export type ArticlesResponse = {
1719 }
1820}
1921
22+ // TODO: Add proper return type annotation
23+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
2024export async function generateStaticParams ( ) {
2125 const articlesResponse = await getArticles ( { page : 0 , pageSize : ARTICLES_PER_PAGE } )
2226 const totalArticles = articlesResponse . meta ?. pagination ?. total || 0
@@ -25,6 +29,13 @@ export async function generateStaticParams() {
2529 return Array . from ( { length : totalPages } , ( _ , i ) => ( { pageIndex : [ ( i + 1 ) . toString ( ) ] } ) )
2630}
2731
32+ // Next.js requires revalidate to be a literal number for static analysis
33+ // This value (3600 seconds = 1 hour) should match CMS_CACHE_TIME in services/cms/index.ts
34+ export const revalidate = 3600
35+
36+ // TODO: Reduce function complexity by extracting logic
37+ // TODO: Add proper return type annotation
38+ // eslint-disable-next-line complexity, @typescript-eslint/explicit-function-return-type
2839export default async function Page ( { params } : Props ) {
2940 const pageParam = ( await params ) ?. pageIndex ?. [ 0 ]
3041 const paramsAreSet = Boolean ( pageParam )
@@ -52,6 +63,8 @@ export default async function Page({ params }: Props) {
5263 const allArticles = allArticlesResponse . data
5364
5465 const articles =
66+ // TODO: Reduce function complexity by extracting logic
67+ // eslint-disable-next-line complexity
5568 articlesResponse . data ?. map ( ( article : Article ) => ( {
5669 ...article ,
5770 id : article . id || 0 ,
@@ -69,7 +82,7 @@ export default async function Page({ params }: Props) {
6982
7083 const categoriesResponse = await getCategories ( )
7184 const allCategories =
72- categoriesResponse ?. map ( ( category : any ) => ( {
85+ categoriesResponse ?. map ( ( category : Category ) => ( {
7386 name : category ?. attributes ?. name || '' ,
7487 slug : category ?. attributes ?. slug || '' ,
7588 } ) ) || [ ]
0 commit comments