All files / app/assets/javascripts/error_tracking/store actions.js

94.11% Statements 16/17
50% Branches 1/2
87.5% Functions 7/8
93.75% Lines 15/16

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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41            1x       1x 2x     1x 1x   1x     1x         1x 1x   1x 1x       1x 1x   1x 1x      
import { createAlert } from '~/alert';
import { visitUrl } from '~/lib/utils/url_utility';
import { __ } from '~/locale';
import service from '../services';
import * as types from './mutation_types';
 
export const setStatus = ({ commit }, status) => {
  commit(types.SET_ERROR_STATUS, status.toLowerCase());
};
 
export const updateStatus = ({ commit }, { endpoint, redirectUrl, status }) =>
  service
    .updateErrorStatus(endpoint, status)
    .then((resp) => {
      commit(types.SET_ERROR_STATUS, status);
      Eif (redirectUrl) visitUrl(redirectUrl);
 
      return resp.data.result;
    })
    .catch(() =>
      createAlert({
        message: __('Failed to update issue status'),
      }),
    );
 
export const updateResolveStatus = ({ commit, dispatch }, params) => {
  commit(types.SET_UPDATING_RESOLVE_STATUS, true);
 
  return dispatch('updateStatus', params).finally(() => {
    commit(types.SET_UPDATING_RESOLVE_STATUS, false);
  });
};
 
export const updateIgnoreStatus = ({ commit, dispatch }, params) => {
  commit(types.SET_UPDATING_IGNORE_STATUS, true);
 
  return dispatch('updateStatus', params).finally(() => {
    commit(types.SET_UPDATING_IGNORE_STATUS, false);
  });
};