summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/mr_notes/stores/actions.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-20 10:00:54 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-20 10:00:54 +0000
commit3cccd102ba543e02725d247893729e5c73b38295 (patch)
treef36a04ec38517f5deaaacb5acc7d949688d1e187 /app/assets/javascripts/mr_notes/stores/actions.js
parent205943281328046ef7b4528031b90fbda70c75ac (diff)
downloadgitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/assets/javascripts/mr_notes/stores/actions.js')
-rw-r--r--app/assets/javascripts/mr_notes/stores/actions.js25
1 files changed, 8 insertions, 17 deletions
diff --git a/app/assets/javascripts/mr_notes/stores/actions.js b/app/assets/javascripts/mr_notes/stores/actions.js
index bc66d1dd68f..0200a8aefc8 100644
--- a/app/assets/javascripts/mr_notes/stores/actions.js
+++ b/app/assets/javascripts/mr_notes/stores/actions.js
@@ -10,23 +10,14 @@ 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 }) {
+export async function fetchMrMetadata({ state, commit }) {
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.');
- });
+ 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);
+ }
}
}