traxxx/assets/js/sites/actions.js

27 lines
616 B
JavaScript

import { get } from '../api';
function initSitesActions(store, _router) {
async function fetchSites({ _commit }, siteId) {
const sites = await get(`/sites/${siteId || ''}`);
return sites;
}
async function fetchSiteReleases({ _commit }, siteId) {
const releases = await get(`/sites/${siteId}/releases`, {
filter: store.state.ui.filter,
after: store.getters.after,
before: store.getters.before,
});
return releases;
}
return {
fetchSites,
fetchSiteReleases,
};
}
export default initSitesActions;