From 5c6ac201510af09a3a6db7648366d9e05b1bf2d5 Mon Sep 17 00:00:00 2001 From: Yusuf Musleh Date: Sun, 23 Jun 2024 17:23:31 +0300 Subject: [PATCH] refactor: Change lib v2 code to TS --- src/studio-home/data/{apiHooks.js => apiHooks.ts} | 10 +++++++++- src/studio-home/tabs-section/index.jsx | 2 +- .../libraries-v2-tab/{index.jsx => index.tsx} | 0 3 files changed, 10 insertions(+), 2 deletions(-) rename src/studio-home/data/{apiHooks.js => apiHooks.ts} (65%) rename src/studio-home/tabs-section/libraries-v2-tab/{index.jsx => index.tsx} (100%) diff --git a/src/studio-home/data/apiHooks.js b/src/studio-home/data/apiHooks.ts similarity index 65% rename from src/studio-home/data/apiHooks.js rename to src/studio-home/data/apiHooks.ts index 92575bf717..efe380c162 100644 --- a/src/studio-home/data/apiHooks.js +++ b/src/studio-home/data/apiHooks.ts @@ -2,10 +2,18 @@ import { useQuery } from '@tanstack/react-query'; import { getStudioHomeLibrariesV2 } from './api'; + +interface CustomParams { + type?: string, + page?: number, + pageSize?: number, + pagination?: boolean, +} + /** * 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/index.jsx b/src/studio-home/tabs-section/index.jsx index 75a3ae12ba..4a33136ea5 100644 --- a/src/studio-home/tabs-section/index.jsx +++ b/src/studio-home/tabs-section/index.jsx @@ -9,7 +9,7 @@ import { useNavigate, useLocation } from 'react-router-dom'; import { getLoadingStatuses, getStudioHomeData } from '../data/selectors'; import messages from './messages'; import LibrariesTab from './libraries-tab'; -import LibrariesV2Tab from './libraries-v2-tab/index'; +import LibrariesV2Tab from './libraries-v2-tab/index.tsx'; import ArchivedTab from './archived-tab'; import CoursesTab from './courses-tab'; import { RequestStatus } from '../../data/constants'; 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 100% rename from src/studio-home/tabs-section/libraries-v2-tab/index.jsx rename to src/studio-home/tabs-section/libraries-v2-tab/index.tsx