feat: series
This commit is contained in:
1 parent
b2eef6c494
commit
1e31520c92
25 files changed
+435
-223
No files matched your search
@@ -4,12 +4,12 @@ import { useInfiniteQuery } from '@tanstack/react-query';
|
||||
|
||||
import { similarMovies } from '@/lib/api';
|
||||
|
||||
const useSimilar = ({ movieId }: { movieId?: string }) => {
|
||||
const useSimilar = ({ movieId, type = 'movie' }: { movieId?: string; type?: ShowType }) => {
|
||||
return useInfiniteQuery({
|
||||
queryKey: ['similar', movieId],
|
||||
queryKey: ['similar', movieId, type],
|
||||
enabled: Boolean(movieId),
|
||||
queryFn: ({ pageParam }) => {
|
||||
return similarMovies({ page: pageParam as string, movieId });
|
||||
return similarMovies({ page: pageParam as string, movieId, type });
|
||||
},
|
||||
getNextPageParam(lastPage) {
|
||||
const { page, total_pages } = lastPage as { page: number; total_pages: number };
|
||||
|
||||
Reference in new issue
Block a user