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

100% Statements 6/6
100% Branches 0/0
100% Functions 4/4
100% Lines 5/5

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          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 dismissErrorAlert = ({ commit }) => commit(types.DISMISS_ERROR_ALERT);
 
export const createUserList = ({ commit, state }, userList) => {
  return Api.createFeatureFlagUserList(state.projectId, {
    ...state.userList,
    ...userList,
  })
    .then(({ data }) => redirectTo(data.path)) // eslint-disable-line import/no-deprecated
    .catch((response) => commit(types.RECEIVE_CREATE_USER_LIST_ERROR, getErrorMessages(response)));
};