All files / app/assets/javascripts/mr_notes/stores actions.js

100% Statements 12/12
75% Branches 3/4
100% Functions 4/4
100% Lines 12/12

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          39x       43x       3x 3x 3x 3x 2x   1x         9x 4x 1x   3x      
import axios from '~/lib/utils/axios_utils';
 
import types from './mutation_types';
 
export function setActiveTab({ commit }, tab) {
  commit(types.SET_ACTIVE_TAB, tab);
}
 
export function setEndpoints({ commit }, endpoints) {
  commit(types.SET_ENDPOINTS, endpoints);
}
 
export async function fetchMrMetadata({ state, commit }) {
  Eif (state.endpoints?.metadata) {
    commit(types.SET_FAILED_TO_LOAD_METADATA, false);
    try {
      const { data } = await axios.get(state.endpoints.metadata);
      commit(types.SET_MR_METADATA, data);
    } catch (error) {
      commit(types.SET_FAILED_TO_LOAD_METADATA, true);
    }
  }
}
 
export const toggleAllVisibleDiscussions = ({ getters, dispatch }) => {
  if (getters.isDiffsPage) {
    dispatch('diffs/toggleAllDiffDiscussions');
  } else {
    dispatch('toggleAllDiscussions');
  }
};