traxxx/assets/js/stashes/actions.js

39 lines
949 B
JavaScript

import { post, del } from '../api';
function initStashesActions(_store, _router) {
async function stashActor(context, { actorId, stashId }) {
await post(`/stashes/${stashId}/actors`, { actorId });
}
async function unstashActor(context, { actorId, stashId }) {
await del(`/stashes/${stashId}/actors/${actorId}`);
}
async function stashScene(context, { sceneId, stashId }) {
await post(`/stashes/${stashId}/scenes`, { sceneId });
}
async function unstashScene(context, { sceneId, stashId }) {
await del(`/stashes/${stashId}/scenes/${sceneId}`);
}
async function stashMovie(context, { movieId, stashId }) {
await post(`/stashes/${stashId}/movies`, { movieId });
}
async function unstashMovie(context, { movieId, stashId }) {
await del(`/stashes/${stashId}/movies/${movieId}`);
}
return {
stashActor,
stashScene,
stashMovie,
unstashActor,
unstashScene,
unstashMovie,
};
}
export default initStashesActions;