Skip to content

Commit

Permalink
Refactor episode xref query hook
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmohan committed Sep 7, 2024
1 parent 99c4b73 commit f17a2be
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/core/react-query/tmdb/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import queryClient from '@/core/react-query/queryClient';

import type {
TmdbBulkRequestType,
TmdbEpisodeXrefRequestType,
TmdbSearchRequestType,
TmdbShowEpisodesRequestType,
} from '@/core/react-query/tmdb/types';
Expand All @@ -27,15 +26,14 @@ export const useTmdbEpisodeXrefsQuery = (
seriesId: number,
isNewLink: boolean,
tmdbShowID: number,
params: TmdbEpisodeXrefRequestType,
enabled = true,
) =>
useQuery<ListResultType<TmdbEpisodeXrefType>, unknown, TmdbEpisodeXrefType[]>({
queryKey: ['series', seriesId, 'tmdb', 'cross-references', 'episode', isNewLink, params, tmdbShowID],
queryKey: ['series', seriesId, 'tmdb', 'cross-references', 'episode', isNewLink, tmdbShowID],
queryFn: () =>
axios.get(
`Series/${seriesId}/TMDB/Show/CrossReferences/Episode${isNewLink ? '/Auto' : ''}`,
{ params: isNewLink ? { ...params, tmdbShowID } : params },
{ params: isNewLink ? { pageSize: 0, tmdbShowID } : { pageSize: 0 } },
),
select: transformListResultSimplified,
enabled,
Expand Down
4 changes: 0 additions & 4 deletions src/core/react-query/tmdb/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import type { PaginationType } from '@/core/types/api';

export type TmdbEpisodeXrefRequestType = {
tmdbShowID?: number;
} & PaginationType;

export type TmdbRefreshRequestType = {
tmdbId: number;
Force?: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/pages/collection/series/TmdbLinking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ const TmdbLinking = () => {
seriesId,
isNewLink,
tmdbId,
{ pageSize: 0 },
!createInProgress && !!seriesId && type === 'Show' && !!seriesQuery.data,
);
const episodeXrefs = useMemo(
Expand Down

0 comments on commit f17a2be

Please sign in to comment.