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

18 lines
560 B
JavaScript
Raw Normal View History

2020-10-24 23:57:45 +05:30
import { deprecatedCreateFlash as flash } 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);
})
.catch(() => flash(__('An error occurred while loading chart data')));
};