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,31 @@
|
||||
import movieAdvisor from '../clients/movieAdvisor';
|
||||
|
||||
export type CreditsQueryProps = {
|
||||
showId?: Show['id'];
|
||||
showType?: Show['type'];
|
||||
};
|
||||
|
||||
const creditsQuery = ({ showId, showType }: CreditsQueryProps) => ({
|
||||
enabled: Boolean(showId),
|
||||
queryKey: ['credits', showId, showType],
|
||||
queryFn: () =>
|
||||
movieAdvisor
|
||||
.get<{
|
||||
cast: Array<Actor | AggregatedActor>;
|
||||
}>(`/${showType}/${showId}/${showType === 'tv' ? 'aggregate_credits' : 'credits'}`)
|
||||
.then(({ cast }) => {
|
||||
return cast
|
||||
.filter((person) => person.profile_path)
|
||||
.map((actor) => {
|
||||
const photoUrl = `https://image.tmdb.org/t/p/w185${actor.profile_path}`;
|
||||
|
||||
if ('character' in actor) return { ...actor, photoUrl };
|
||||
|
||||
const [{ character }] = actor.roles || [{}];
|
||||
|
||||
return { ...actor, character, photoUrl };
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
export default creditsQuery;
|
||||
Reference in new issue
Block a user