aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/recherche/index.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-12-01 19:34:58 +0100
committerArmand Philippot <git@armandphilippot.com>2023-12-04 19:00:04 +0100
commit53b63ac27c2275262db9a04be02210a3287aa71d (patch)
tree814968e10cad25e1b34ab251de42ac5ecb82b346 /src/pages/recherche/index.tsx
parent11e3ee75fcab0ab54b2bc1713a402c5cc3070c2d (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/index.tsx')
-rw-r--r--src/pages/recherche/index.tsx10
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,
});