debian-mirror-gitlab/app/assets/javascripts/mr_notes/stores/actions.js

33 lines
956 B
JavaScript
Raw Normal View History

2021-04-29 21:17:54 +05:30
import axios from '~/lib/utils/axios_utils';
2018-11-08 19:23:39 +05:30
import types from './mutation_types';
2021-04-29 21:17:54 +05:30
export function setActiveTab({ commit }, tab) {
commit(types.SET_ACTIVE_TAB, tab);
}
export function setEndpoints({ commit }, endpoints) {
commit(types.SET_ENDPOINTS, endpoints);
}
export function setMrMetadata({ commit }, metadata) {
commit(types.SET_MR_METADATA, metadata);
}
export function fetchMrMetadata({ dispatch, state }) {
if (state.endpoints?.metadata) {
axios
.get(state.endpoints.metadata)
.then((response) => {
dispatch('setMrMetadata', response.data);
})
.catch(() => {
// https://gitlab.com/gitlab-org/gitlab/-/issues/324740
// We can't even do a simple console warning here because
// the pipeline will fail. However, the issue above will
// eventually handle errors appropriately.
// console.warn('Failed to load MR Metadata for the Overview tab.');
});
}
}