debian-mirror-gitlab/app/assets/javascripts/contributors/stores/actions.js

22 lines
583 B
JavaScript
Raw Normal View History

2021-09-30 23:02:18 +05:30
import createFlash from '~/flash';
2019-12-26 22:10:19 +05:30
import { __ } from '~/locale';
import service from '../services/contributors_service';
import * as types from './mutation_types';
export const fetchChartData = ({ commit }, endpoint) => {
commit(types.SET_LOADING_STATE, true);
return service
.fetchChartData(endpoint)
2021-03-08 18:12:59 +05:30
.then((res) => res.data)
.then((data) => {
2019-12-26 22:10:19 +05:30
commit(types.SET_CHART_DATA, data);
commit(types.SET_LOADING_STATE, false);
})
2021-09-30 23:02:18 +05:30
.catch(() =>
createFlash({
message: __('An error occurred while loading chart data'),
}),
);
2019-12-26 22:10:19 +05:30
};