From cd19e9e5e122c9a7ddef27349961523e859d5b86 Mon Sep 17 00:00:00 2001 From: viown <48097677+viown@users.noreply.github.com> Date: Thu, 6 Mar 2025 10:14:04 +0300 Subject: [PATCH] Cleanup hooks --- .../features/search/api/useArtistsSearch.ts | 22 ++++++++----------- .../features/search/api/usePeopleSearch.ts | 20 +++++++---------- .../features/search/api/useVideoSearch.ts | 22 ++++++++----------- 3 files changed, 26 insertions(+), 38 deletions(-) diff --git a/src/apps/stable/features/search/api/useArtistsSearch.ts b/src/apps/stable/features/search/api/useArtistsSearch.ts index 6bcaaa2b9f..aa929d18e9 100644 --- a/src/apps/stable/features/search/api/useArtistsSearch.ts +++ b/src/apps/stable/features/search/api/useArtistsSearch.ts @@ -35,19 +35,15 @@ export const useArtistsSearch = ( return useQuery({ queryKey: ['ArtistsSearch', collectionType, parentId, searchTerm], - queryFn: async ({ signal }) => { - const artistsData = await fetchArtists( - api!, - userId!, - { - parentId: parentId, - searchTerm: searchTerm - }, - { signal } - ); - - return artistsData; - }, + queryFn: ({ signal }) => fetchArtists( + api!, + userId!, + { + parentId: parentId, + searchTerm: searchTerm + }, + { signal } + ), enabled: !!api && !!userId && (!collectionType || isMusic(collectionType)) }); }; diff --git a/src/apps/stable/features/search/api/usePeopleSearch.ts b/src/apps/stable/features/search/api/usePeopleSearch.ts index d485e9362c..92f1f0f3d4 100644 --- a/src/apps/stable/features/search/api/usePeopleSearch.ts +++ b/src/apps/stable/features/search/api/usePeopleSearch.ts @@ -37,18 +37,14 @@ export const usePeopleSearch = ( return useQuery({ queryKey: ['PeopleSearch', collectionType, parentId, searchTerm], - queryFn: async ({ signal }) => { - const peopleData = await fetchPeople( - api!, - userId!, - { - searchTerm: searchTerm - }, - { signal } - ); - - return peopleData; - }, + queryFn: ({ signal }) => fetchPeople( + api!, + userId!, + { + searchTerm: searchTerm + }, + { signal } + ), enabled: !!api && !!userId && isPeopleEnabled }); }; diff --git a/src/apps/stable/features/search/api/useVideoSearch.ts b/src/apps/stable/features/search/api/useVideoSearch.ts index a4b1a6be13..d5711b1987 100644 --- a/src/apps/stable/features/search/api/useVideoSearch.ts +++ b/src/apps/stable/features/search/api/useVideoSearch.ts @@ -43,19 +43,15 @@ export const useVideoSearch = ( return useQuery({ queryKey: ['VideoSearch', collectionType, parentId, searchTerm], - queryFn: async ({ signal }) => { - const videosData = await fetchPeople( - api!, - userId!, - { - parentId: parentId, - searchTerm: searchTerm - }, - { signal } - ); - - return videosData; - }, + queryFn: ({ signal }) => fetchPeople( + api!, + userId!, + { + parentId: parentId, + searchTerm: searchTerm + }, + { signal } + ), enabled: !!api && !!userId && !collectionType }); };