2019-11-11 02:20:00 +00:00
|
|
|
import { get } from '../api';
|
|
|
|
|
2019-11-15 04:10:59 +00:00
|
|
|
function initSitesActions(store, _router) {
|
2019-11-11 02:20:00 +00:00
|
|
|
async function fetchSites({ _commit }, siteId) {
|
|
|
|
const sites = await get(`/sites/${siteId || ''}`);
|
|
|
|
|
|
|
|
return sites;
|
|
|
|
}
|
|
|
|
|
|
|
|
async function fetchSiteReleases({ _commit }, siteId) {
|
2019-11-15 04:10:59 +00:00
|
|
|
const releases = await get(`/sites/${siteId}/releases`, {
|
|
|
|
filter: store.state.ui.filter,
|
|
|
|
after: store.getters.after,
|
|
|
|
before: store.getters.before,
|
|
|
|
});
|
2019-11-11 02:20:00 +00:00
|
|
|
|
|
|
|
return releases;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
fetchSites,
|
|
|
|
fetchSiteReleases,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default initSitesActions;
|