diff --git a/src/studio-home/data/apiHooks.js b/src/studio-home/data/apiHooks.ts similarity index 60% rename from src/studio-home/data/apiHooks.js rename to src/studio-home/data/apiHooks.ts index 92575bf717..d9461aa705 100644 --- a/src/studio-home/data/apiHooks.js +++ b/src/studio-home/data/apiHooks.ts @@ -2,10 +2,20 @@ import { useQuery } from '@tanstack/react-query'; import { getStudioHomeLibrariesV2 } from './api'; + +interface CustomParams { + type?: string, + page?: number, + pageSize?: number, + pagination?: boolean, + order?: string, + saerch?: string, +} + /** * Builds the query to fetch list of V2 Libraries */ -const useListStudioHomeV2Libraries = (customParams) => ( +const useListStudioHomeV2Libraries = (customParams: CustomParams) => ( useQuery({ queryKey: ['listV2Libraries', customParams], queryFn: () => getStudioHomeLibrariesV2(customParams), diff --git a/src/studio-home/tabs-section/libraries-v2-tab/index.jsx b/src/studio-home/tabs-section/libraries-v2-tab/index.tsx similarity index 96% rename from src/studio-home/tabs-section/libraries-v2-tab/index.jsx rename to src/studio-home/tabs-section/libraries-v2-tab/index.tsx index 7f57e74528..ab84652d12 100644 --- a/src/studio-home/tabs-section/libraries-v2-tab/index.jsx +++ b/src/studio-home/tabs-section/libraries-v2-tab/index.tsx @@ -62,7 +62,7 @@ const LibrariesV2Tab = ({ : `${window.location.origin}${getPath(getConfig().PUBLIC_PATH)}library/${id}` ); - const hasV2Libraries = data?.results?.length > 0; + const hasV2Libraries = (data?.results?.length || 0) > 0; return ( isError ? ( @@ -98,7 +98,7 @@ const LibrariesV2Tab = ({ { hasV2Libraries - ? data.results.map(({ + ? data?.results.map(({ id, org, slug, title, }) => ( 1 + (data?.numPages || 0) > 1 && (