fix: SITE_URL
This commit is contained in:
1 parent
1fe912f4bd
commit
dfdfb79169
66 files changed
+1352
-240
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import movieAdvisor from '../clients/movieAdvisor';
|
||||
import mapMoviesSeriesResponseToShows from '../dto/Show';
|
||||
|
||||
export type TrendingQueryProps = {
|
||||
type: 'trending' | 'streaming' | 'theater';
|
||||
};
|
||||
|
||||
const trendingQuery = ({ type }: TrendingQueryProps) => ({
|
||||
queryKey: ['trending', `type-${type}`],
|
||||
queryFn: () => {
|
||||
const params: Record<string, string | number> = {};
|
||||
|
||||
if (type !== 'trending') {
|
||||
params['watch_region'] = 'US';
|
||||
}
|
||||
|
||||
if (type === 'theater') {
|
||||
params['with_release_type'] = 3;
|
||||
}
|
||||
|
||||
if (type === 'streaming') {
|
||||
params['with_watch_monetization_types'] = 'flatrate';
|
||||
}
|
||||
|
||||
return movieAdvisor
|
||||
.get<TMDBPagination<Movie>>(type === 'trending' ? '/trending/movie/day' : '/discover/movie', {
|
||||
params
|
||||
})
|
||||
.then((response) => {
|
||||
const data = mapMoviesSeriesResponseToShows(response);
|
||||
|
||||
return data.results;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export default trendingQuery;
|
||||
Reference in new issue
Block a user