-
Notifications
You must be signed in to change notification settings - Fork 52
fix(PM-1077): handled errors for certain use cases #1643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
@@ -46,14 +46,17 @@ const UserAddModalContent = ({ projectId, addNewProjectMember, onMemberInvited, | |||
|
|||
try { | |||
if (userPermissionToAdd === PROJECT_ROLES.COPILOT) { | |||
const { success: invitations = [], failed } = await inviteUserToProject(projectId, { | |||
const { success: invitations = [], failed, ...rest } = await inviteUserToProject(projectId, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable rest
is being destructured from the response of inviteUserToProject
, but it's not clear what properties it contains. Ensure that rest.message
is a valid property and handle cases where it might not exist.
setAddUserError(error) | ||
setIsAdding(false) | ||
} else if (rest.message) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition else if (rest.message)
assumes that rest.message
is an error message. Consider checking if rest.message
is indeed an error or if it should be handled differently.
@@ -90,7 +90,7 @@ class Users extends Component { | |||
projectMembers, | |||
invitedMembers: invitedMembers.map(m => ({ | |||
...m, | |||
email: m.email || invitedUsers[m.userId].email | |||
email: m.email || invitedUsers[m.userId].handle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name email
is now being used to store a handle
. Consider renaming the variable to handle
for clarity and to avoid confusion, as it no longer represents an email address.
What's in this PR?
Ticket link - https://topcoder.atlassian.net/browse/PM-1077