traxxx/assets/js/actors/actions.js

29 lines
692 B
JavaScript
Raw Normal View History

import { get } from '../api';
function initActorActions(store, _router) {
async function fetchActors({ _commit }, { actorId, limit = 100 }) {
if (actorId) {
return get(`/actors/${actorId}`, { limit });
}
return get('/actors', { limit });
}
async function fetchActorReleases({ _commit }, actorId) {
const releases = await get(`/actors/${actorId}/releases`, {
filter: store.state.ui.filter,
after: store.getters.after,
before: store.getters.before,
});
return releases;
}
return {
fetchActors,
fetchActorReleases,
};
}
export default initActorActions;