Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
bb0d746e
Commit
bb0d746e
authored
May 11, 2018
by
Dennis Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clear errors on successful gapi request
parent
f884d598
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js
...vascripts/projects/gke_cluster_dropdowns/store/actions.js
+11
-2
No files found.
app/assets/javascripts/projects/gke_cluster_dropdowns/store/actions.js
View file @
bb0d746e
/* 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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment