summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Tang <dtang@gitlab.com>2018-05-11 20:26:01 +0200
committerDennis Tang <dtang@gitlab.com>2018-05-11 20:26:01 +0200
commitbb0d746e4d3344a3b372698115a55063f9dbcbb0 (patch)
treebbdb115d94eac450e6c4c5843ddfcad6d681e19c
parentf884d5985795aeb43234234b1e63131de7f3602f (diff)
downloadgitlab-ce-bb0d746e4d3344a3b372698115a55063f9dbcbb0.tar.gz
clear errors on successful gapi request
-rw-r--r--app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js b/app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js
index cba88368358..73f1e17f379 100644
--- a/app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js
+++ b/app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js
@@ -1,5 +1,5 @@
/* global gapi */
-import Flash from '~/flash';
+import createFlash, { hideFlash } from '~/flash';
import { s__, sprintf } from '~/locale';
import * as types from './mutation_types';
@@ -18,7 +18,15 @@ export const setMachineType = ({ commit }, selectedMachineType) => {
const displayError = (resp, errorMessage) => {
if (resp.result && resp.result.error) {
- Flash(sprintf(errorMessage, { error: resp.result.error.message }));
+ createFlash(sprintf(errorMessage, { error: resp.result.error.message }));
+ }
+};
+
+const hideError = () => {
+ const flashEl = document.querySelector('.flash-alert');
+
+ if (flashEl) {
+ hideFlash(flashEl);
}
};
@@ -30,6 +38,7 @@ const gapiRequest = ({ service, params, commit, mutation, payloadKey, errorMessa
resp => {
const { result } = resp;
+ hideError();
commit(mutation, result[payloadKey]);
resolve();