Skip to content

Commit

Permalink
chore: 사용처에서 네이밍을 변경하도록 수정(#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgksqkr committed Jun 18, 2024
1 parent 4c5934d commit 5d2fe97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/search/searchBodySection/SearchBodySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')!;
Expand Down Expand Up @@ -39,7 +39,7 @@ const SearchBodySection = () => {
</S.TextImageWrapper>
<SearchForm searchKeyword={searchKeyword} type="search" />
</S.SearchBarWrapper>
<SearchResultContainer searchResult={searchResult} searchKeyword={searchKeyword} />
<SearchResultContainer searchResult={searchResult} searchKeyword={searchKeyword} isPending={isPending} />
</>
);
};
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/useSearchQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

0 comments on commit 5d2fe97

Please sign in to comment.