Welcome to mirror list, hosted at ThFree Co, Russian Federation.

actions.js « merge_requests « modules « stores « ide « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d3050183bd3961eedecabc61605997c028b1110a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { __ } from '../../../../locale';
import Api from '../../../../api';
import flash from '../../../../flash';
import * as types from './mutation_types';

export const requestMergeRequests = ({ commit }) => commit(types.REQUEST_MERGE_REQUESTS);
export const receiveMergeRequestsError = ({ commit }) => {
  flash(__('Error loading merge requests.'));
  commit(types.RECEIVE_MERGE_REQUESTS_ERROR);
};
export const receiveMergeRequestsSuccess = ({ commit }, data) =>
  commit(types.RECEIVE_MERGE_REQUESTS_SUCCESS, data);

export const fetchMergeRequests = ({ dispatch, state: { scope, state } }, search = '') => {
  dispatch('requestMergeRequests');
  dispatch('resetMergeRequests');

  Api.mergeRequests({ scope, state, search })
    .then(({ data }) => dispatch('receiveMergeRequestsSuccess', data))
    .catch(() => dispatch('receiveMergeRequestsError'));
};

export const resetMergeRequests = ({ commit }) => commit(types.RESET_MERGE_REQUESTS);

export default () => {};