2023-05-27 22:25:52 +05:30
|
|
|
import { createAlert } from '~/alert';
|
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(() =>
|
2022-11-25 23:54:43 +05:30
|
|
|
createAlert({
|
2021-09-30 23:02:18 +05:30
|
|
|
message: __('An error occurred while loading chart data'),
|
|
|
|
}),
|
|
|
|
);
|
2019-12-26 22:10:19 +05:30
|
|
|
};
|