From 5d2fe97eff3e00f1106603322149b2f003a53d39 Mon Sep 17 00:00:00 2001 From: rbgksqkr Date: Tue, 18 Jun 2024 15:10:10 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EC=82=AC=EC=9A=A9=EC=B2=98=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=84=A4=EC=9D=B4=EB=B0=8D=EC=9D=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95(#120)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/search/searchBodySection/SearchBodySection.tsx | 4 ++-- src/hooks/useSearchQuery.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/search/searchBodySection/SearchBodySection.tsx b/src/components/search/searchBodySection/SearchBodySection.tsx index 1004033..75a10c6 100644 --- a/src/components/search/searchBodySection/SearchBodySection.tsx +++ b/src/components/search/searchBodySection/SearchBodySection.tsx @@ -11,7 +11,7 @@ const SearchBodySection = () => { const router = useRouter(); const params = useSearchParams(); const [searchKeyword, setSearchKeyword] = useState(''); - const searchResult = useSearchQuery(searchKeyword); + const { data: searchResult, isPending } = useSearchQuery(searchKeyword); useEffect(() => { const searchParams = params.get('search')!; @@ -39,7 +39,7 @@ const SearchBodySection = () => { - + ); }; diff --git a/src/hooks/useSearchQuery.ts b/src/hooks/useSearchQuery.ts index 6cae2ef..8ba2f11 100644 --- a/src/hooks/useSearchQuery.ts +++ b/src/hooks/useSearchQuery.ts @@ -2,11 +2,10 @@ import { getSearchResult } from '@/apis/docs'; import { useQuery } from '@tanstack/react-query'; export const useSearchQuery = (searchKeyword: string) => { - const { data: searchResult } = useQuery({ + return useQuery({ queryKey: ['search', searchKeyword], queryFn: () => getSearchResult(searchKeyword), enabled: !!searchKeyword, staleTime: 60 * 1000, }); - return searchResult; };