14 lines
363 B
TypeScript
14 lines
363 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
|
|
import { credits } from '@/lib/api';
|
|
|
|
const useCredits = ({ movieId, type }: { movieId?: Movie['id']; type?: ShowType }) => {
|
|
return useQuery({
|
|
queryKey: ['credits', movieId, type],
|
|
queryFn: () => credits({ movieId: movieId!, type }),
|
|
enabled: Boolean(movieId)
|
|
});
|
|
};
|
|
|
|
export default useCredits;
|