diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-12-01 19:34:58 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-12-04 19:00:04 +0100 |
| commit | 53b63ac27c2275262db9a04be02210a3287aa71d (patch) | |
| tree | 814968e10cad25e1b34ab251de42ac5ecb82b346 /src/pages/recherche | |
| parent | 11e3ee75fcab0ab54b2bc1713a402c5cc3070c2d (diff) | |
refactor(pages): refine Blog pages
* replace usePostsList with useArticlesList to keep names coherent
* remove useIsMounted hook
* rewrite useRedirection hook
* add redirect in getStaticProps to avoid unecessary fetching
* move Pagination component in a noscript tag
* use hooks to refresh thematics and topics lists
* complete Cypress tests
Diffstat (limited to 'src/pages/recherche')
| -rw-r--r-- | src/pages/recherche/index.tsx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pages/recherche/index.tsx b/src/pages/recherche/index.tsx index bb3aa53..2bcb1c0 100644 --- a/src/pages/recherche/index.tsx +++ b/src/pages/recherche/index.tsx @@ -23,7 +23,6 @@ import { convertWPThematicPreviewToPageLink, convertWPTopicPreviewToPageLink, fetchPostsCount, - fetchPostsList, fetchThematicsCount, fetchThematicsList, fetchTopicsCount, @@ -45,7 +44,11 @@ import { getWebPageSchema, } from '../../utils/helpers'; import { loadTranslation, type Messages } from '../../utils/helpers/server'; -import { useBreadcrumb, useDataFromAPI, usePostsList } from '../../utils/hooks'; +import { + useArticlesList, + useBreadcrumb, + useDataFromAPI, +} from '../../utils/hooks'; type SearchPageProps = { thematicsList: WPThematicPreview[]; @@ -125,9 +128,8 @@ const SearchPage: NextPageWithLayout<SearchPageProps> = ({ isRefreshing, hasNextPage, loadMore, - } = usePostsList({ + } = useArticlesList({ fallback: [], - fetcher: fetchPostsList, perPage: CONFIG.postsPerPage, searchQuery: query.s as string, }); |
