feat(show-type): global movie/series toggle, type-aware pages and search, ?type=tv in URL

This commit is contained in:
ner committed 2026-09-24 15:40:01 +03:00
1 parent 5b41dbca10
commit 0824090c6d
21 files changed
+415 -174

No files matched your search

+5 -4
View File
@@ -3,14 +3,15 @@ import mapMoviesSeriesResponseToShows from '../dto/Show';
export type PopularQueryProps = {
sortBy?: string;
type?: Show['type'];
};
const popularQuery = ({ sortBy = 'popularity.desc' }: PopularQueryProps = {}) => ({
queryKey: ['popular', sortBy],
const popularQuery = ({ sortBy = 'popularity.desc', type = 'movie' }: PopularQueryProps = {}) => ({
queryKey: ['popular', type, sortBy],
initialPageParam: '1',
queryFn: ({ pageParam = '1' }: { pageParam?: string }) =>
movieAdvisor
.get<TMDBPagination<Movie>>('/discover/movie', {
.get<TMDBPagination<Movie> | TMDBPagination<Series>>(`/discover/${type}`, {
params: {
page: pageParam,
sort_by: sortBy,
@@ -19,7 +20,7 @@ const popularQuery = ({ sortBy = 'popularity.desc' }: PopularQueryProps = {}) =>
'vote_average.gte': 5
}
})
.then(mapMoviesSeriesResponseToShows)
.then((response) => mapMoviesSeriesResponseToShows(response, type))
});
export default popularQuery;