From e9d5a40432c451090e17859c764e52a96120b712 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 4 Dec 2023 19:36:34 +0100
Subject: refactor(pages): refine Search page

* extract NoResults component to improve readability
* provide a different message when the url does not contain a query
* use hooks to refresh Thematics and Topics lists
* remove useDataFromApi hook
---
 src/utils/hooks/use-data-from-api.tsx | 21 ---------------------
 1 file changed, 21 deletions(-)
 delete mode 100644 src/utils/hooks/use-data-from-api.tsx

(limited to 'src/utils/hooks/use-data-from-api.tsx')

diff --git a/src/utils/hooks/use-data-from-api.tsx b/src/utils/hooks/use-data-from-api.tsx
deleted file mode 100644
index 5abcf09..0000000
--- a/src/utils/hooks/use-data-from-api.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { useEffect, useState } from 'react';
-
-/**
- * Fetch data from an API.
- *
- * This hook is a wrapper to `setState` + `useEffect`.
- *
- * @param fetcher - A function to fetch data from API.
- * @returns {T | undefined} The requested data.
- */
-export const useDataFromAPI = <T,>(
-  fetcher: () => Promise<T>
-): T | undefined => {
-  const [data, setData] = useState<T>();
-
-  useEffect(() => {
-    fetcher().then((apiData) => setData(apiData));
-  }, [fetcher]);
-
-  return data;
-};
-- 
cgit v1.2.3

