Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
05b3a062
Unverified
Commit
05b3a062
authored
Jun 25, 2021
by
Paul Kaplan
Committed by
GitHub
Jun 25, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5670 from paulkaplan/show-rate-limit-error-correctly
parents
07c7ab81
b2c9c922
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
src/views/studio/modals/user-projects-tile.jsx
src/views/studio/modals/user-projects-tile.jsx
+10
-7
src/views/studio/studio-project-adder.jsx
src/views/studio/studio-project-adder.jsx
+2
-0
No files found.
src/views/studio/modals/user-projects-tile.jsx
View file @
05b3a062
...
...
@@ -3,6 +3,7 @@ import React, {useContext, useState} from 'react';
import
PropTypes
from
'
prop-types
'
;
import
classNames
from
'
classnames
'
;
import
AlertContext
from
'
../../../components/alert/alert-context.js
'
;
import
{
errorToMessageId
}
from
'
../studio-project-adder.jsx
'
;
const
UserProjectsTile
=
({
id
,
title
,
image
,
inStudio
,
onAdd
,
onRemove
})
=>
{
const
[
submitting
,
setSubmitting
]
=
useState
(
false
);
...
...
@@ -10,17 +11,19 @@ const UserProjectsTile = ({id, title, image, inStudio, onAdd, onRemove}) => {
const
{
errorAlert
}
=
useContext
(
AlertContext
);
const
toggle
=
()
=>
{
setSubmitting
(
true
);
(
added
?
onRemove
(
id
)
:
onAdd
(
id
))
const
adding
=
!
added
;
// for clarity, the current action is opposite of previous state
(
adding
?
onAdd
(
id
)
:
onRemove
(
id
))
.
then
(()
=>
{
setAdded
(
!
added
);
setAdded
(
adding
);
setSubmitting
(
false
);
})
.
catch
(()
=>
{
.
catch
(
e
=>
{
// if adding, use the same error messages as the add-by-url component
// otherwise use a single generic message for remove errors
const
errorId
=
adding
?
errorToMessageId
(
e
)
:
'
studio.alertProjectRemoveError
'
;
setSubmitting
(
false
);
errorAlert
({
id
:
added
?
'
studio.alertProjectRemoveError
'
:
'
studio.alertProjectAddError
'
},
null
);
errorAlert
({
id
:
errorId
},
null
);
});
};
return
(
...
...
src/views/studio/studio-project-adder.jsx
View file @
05b3a062
...
...
@@ -103,3 +103,5 @@ const mapDispatchToProps = ({
});
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
StudioProjectAdder
);
export
{
errorToMessageId
};
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