summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js')
-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();