From 53b63ac27c2275262db9a04be02210a3287aa71d Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 1 Dec 2023 19:34:58 +0100
Subject: 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
---
 src/utils/hooks/use-redirection.tsx | 31 -------------------------------
 1 file changed, 31 deletions(-)
 delete mode 100644 src/utils/hooks/use-redirection.tsx

(limited to 'src/utils/hooks/use-redirection.tsx')

diff --git a/src/utils/hooks/use-redirection.tsx b/src/utils/hooks/use-redirection.tsx
deleted file mode 100644
index 5a677e2..0000000
--- a/src/utils/hooks/use-redirection.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { useRouter } from 'next/router';
-import { useEffect } from 'react';
-
-export type RouterQuery = {
-  param: string;
-  value: string;
-};
-
-export type UseRedirectionProps = {
-  /**
-   * The router query.
-   */
-  query: RouterQuery;
-  /**
-   * The redirection url.
-   */
-  redirectTo: string;
-};
-
-/**
- * Redirect to another url when router query match the given parameters.
- *
- * @param {UseRedirectionProps} props - The redirection parameters.
- */
-export const useRedirection = ({ query, redirectTo }: UseRedirectionProps) => {
-  const router = useRouter();
-
-  useEffect(() => {
-    if (router.query[query.param] === query.value) router.push(redirectTo);
-  }, [query, redirectTo, router]);
-};
-- 
cgit v1.2.3

