refactor: clean code and remove unnecessary dependencies
This commit is contained in:
1 parent
eceae6fec7
commit
ebf599eed6
92 files changed
+1152
-2842
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
|
||||
import { popularByType, trendingMovies } from '@/api';
|
||||
|
||||
const useTrending = ({ type, enabled }: { enabled?: boolean; type: 'trending' | 'streaming' | 'theater' | 'rent' }) => {
|
||||
return useQuery({
|
||||
enabled,
|
||||
queryKey: ['trending', type],
|
||||
queryFn: () => (type === 'trending' ? trendingMovies() : popularByType({ type }))
|
||||
});
|
||||
};
|
||||
|
||||
export default useTrending;
|
||||
Reference in new issue
Block a user