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

actions.js « gitlab_user_list « store « feature_flags « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a834524df6cd10e318beaad9eca9282b7ead72ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import Api from '~/api';
import * as types from './mutation_types';

const getErrorMessages = (error) => [].concat(error?.response?.data?.message ?? error.message);

export const fetchUserLists = ({ commit, state: { filter, projectId } }) => {
  commit(types.FETCH_USER_LISTS);

  return Api.searchFeatureFlagUserLists(projectId, filter)
    .then(({ data }) => commit(types.RECEIVE_USER_LISTS_SUCCESS, data))
    .catch((error) => commit(types.RECEIVE_USER_LISTS_ERROR, getErrorMessages(error)));
};

export const setFilter = ({ commit, dispatch }, filter) => {
  commit(types.SET_FILTER, filter);
  return dispatch('fetchUserLists');
};