Skip to content

Commit 537a94b

Browse files
committed
fix: action string
1 parent e551d12 commit 537a94b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/components/Users/user-add.modal.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ const UserAddModalContent = ({
9090

9191
const onConfirmCopilotRoleChange = async () => {
9292
const member = projectMembers.find(item => item.userId === userToAdd.userId)
93-
const response = await updateProjectMemberRole(projectId, member.id, 'copilot')
93+
const action = member.role === 'manager' ? 'complete-copilot-requests' : ''
94+
const response = await updateProjectMemberRole(projectId, member.id, 'copilot', action)
9495
updateProjectMember(response)
9596
onClose(true)
9697
}
@@ -103,7 +104,7 @@ const UserAddModalContent = ({
103104
return (
104105
<Modal theme={theme} onCancel={onClose}>
105106
{
106-
isUserAddingFailed && (existingRole === 'observer' || existingRole === 'customer' || existingRole === 'copilot') && (
107+
isUserAddingFailed && (existingRole === 'observer' || existingRole === 'customer' || existingRole === 'copilot' || existingRole === 'manager') && (
107108
<div className={cn(styles.contentContainer, styles.confirm)}>
108109
<div className={styles.textContent}>{`The copilot ${userToAdd.handle} is part of ${projectOption.label} project with ${existingRole} role.`}</div>
109110
<div className={styles.buttonWrapper}>

src/services/projects.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ export async function fetchProjectPhases (id) {
103103
* @param newRole the new role
104104
* @returns {Promise<*>}
105105
*/
106-
export async function updateProjectMemberRole (projectId, memberRecordId, newRole) {
106+
export async function updateProjectMemberRole (projectId, memberRecordId, newRole, action) {
107107
const response = await axiosInstance.patch(`${PROJECTS_API_URL}/${projectId}/members/${memberRecordId}`, {
108-
role: newRole
108+
role: newRole,
109+
action
109110
})
110111
return _.get(response, 'data')
111112
}

0 commit comments

Comments
 (0)