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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
628 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);
}
2022-06-21 17:19:12 +05:30
export async function fetchMrMetadata({ state, commit }) {
2021-04-29 21:17:54 +05:30
if (state.endpoints?.metadata) {
2022-06-21 17:19:12 +05:30
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);
}
2021-04-29 21:17:54 +05:30
}
}