refactoring: server actions => tmdb proxy
This commit is contained in:
1 parent
dfdfb79169
commit
97d55b24a1
13 files changed
+131
-113
No files matched your search
@@ -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;
|
||||
Reference in new issue
Block a user