All files / app/assets/javascripts/user_lists/store/edit actions.js

100% Statements 11/11
100% Branches 0/0
100% Functions 7/7
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23          2x 13x 13x 8x 4x     2x   2x 6x       3x 3x    
import Api from '~/api';
import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
import { getErrorMessages } from '../utils';
import * as types from './mutation_types';
 
export const fetchUserList = ({ commit, state }) => {
  commit(types.REQUEST_USER_LIST);
  return Api.fetchFeatureFlagUserList(state.projectId, state.userListIid)
    .then(({ data }) => commit(types.RECEIVE_USER_LIST_SUCCESS, data))
    .catch((response) => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response)));
};
 
export const dismissErrorAlert = ({ commit }) => commit(types.DISMISS_ERROR_ALERT);
 
export const updateUserList = ({ commit, state }, userList) => {
  return Api.updateFeatureFlagUserList(state.projectId, {
    iid: userList.iid,
    name: userList.name,
  })
    .then(({ data }) => redirectTo(data.path)) // eslint-disable-line import/no-deprecated
    .catch((response) => commit(types.RECEIVE_USER_LIST_ERROR, getErrorMessages(response)));
};