refactoring: server actions => tmdb proxy

This commit is contained in:
ner committed 2024-10-28 20:04:36 +02:00
1 parent dfdfb79169
commit 97d55b24a1
13 files changed
+131 -113

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import movieAdvisor from '../clients/movieAdvisor';
export type StatesMutationProps = {
session?: string;
};
export type StatesMutationFnProps = {
showId: Show['id'];
showType: Show['type'];
list: 'favorite' | 'watchlist';
value: boolean;
};
const statesMutation = ({ session }: StatesMutationProps) => ({
retry: 2,
mutationFn: ({ showId, showType, list, value }: StatesMutationFnProps) =>
movieAdvisor.post(
`/account/null/${list}`,
{ params: { session_id: session }, preventCache: true },
{
media_id: showId,
media_type: showType,
[list]: value
}
)
});
export default statesMutation;