@@ -38,7 +38,8 @@ export const InvitePopup: React.FC<{
3838 const invite = useSelector ( organizationSelectors . invite ) ;
3939 const roles = useSelector ( rolesSelectors . getRoles ) ;
4040
41- const [ role , setrole ] = useState ( '' ) ;
41+ const [ role , setRole ] = useState ( '' ) ;
42+
4243 const authToken = useSelector ( sessionSelectors . authenticationToken ) ;
4344
4445 const inviteNewMembers = ( ) => {
@@ -62,8 +63,12 @@ export const InvitePopup: React.FC<{
6263 } ;
6364 axios
6465 . post (
65- `${ process . env . REACT_APP_BASE_API_URL } /users/${ user . id } /roles?role_name_or_id=${ role } ` ,
66- { } ,
66+ // users/${user.id}/roles?role_name_or_id=${role}
67+ `${ process . env . REACT_APP_BASE_API_URL } /role_assignments` ,
68+ {
69+ user : user . id ,
70+ role : role ,
71+ } ,
6772 { headers } ,
6873 )
6974 . then ( ( ) => {
@@ -93,8 +98,8 @@ export const InvitePopup: React.FC<{
9398 ) ;
9499 }
95100 } ;
96- function handleChange ( value : any ) {
97- setrole ( value ) ;
101+ function handleChange ( value : string ) {
102+ setRole ( value ) ;
98103 }
99104
100105 return (
@@ -126,37 +131,40 @@ export const InvitePopup: React.FC<{
126131 } }
127132 />
128133 </ Box >
129- < Box marginLeft = "md" >
130- < FlexBox . Column fullWidth >
131- < Box paddingBottom = "xs" >
132- < Paragraph size = "body" style = { { color : 'black' } } >
133- < label htmlFor = { name } > { 'Roles' } </ label >
134- </ Paragraph >
135- </ Box >
136- < select
137- onChange = { ( e : any ) => handleChange ( e . target . value ) }
138- value = { role }
139- placeholder = { 'Roles' }
140- className = { cn ( styles . input ) }
141- style = { {
142- // borderTopRightRadius: 0,
143- // borderBottomRightRadius: 0,
144- width : '146px' ,
145- fontSize : '12px' ,
146- color : '#424240' ,
147- } }
148- >
149- < option selected disabled value = "" >
150- { 'Roles' }
151- </ option >
152- { roles . map ( ( option , index ) => (
153- < option key = { index } value = { option . name } >
154- { option . name . toUpperCase ( ) }
134+ { ! showTokField && (
135+ < Box marginLeft = "md" >
136+ < FlexBox . Column fullWidth >
137+ < Box paddingBottom = "xs" >
138+ < Paragraph size = "body" style = { { color : 'black' } } >
139+ < label htmlFor = { name } > { 'Roles' } </ label >
140+ </ Paragraph >
141+ </ Box >
142+
143+ < select
144+ onChange = { ( e : any ) => handleChange ( e . target . value ) }
145+ value = { role }
146+ placeholder = { 'Roles' }
147+ className = { cn ( styles . input ) }
148+ style = { {
149+ // borderTopRightRadius: 0,
150+ // borderBottomRightRadius: 0,
151+ width : '146px' ,
152+ fontSize : '12px' ,
153+ color : '#424240' ,
154+ } }
155+ >
156+ < option selected disabled value = "" >
157+ { 'Roles' }
155158 </ option >
156- ) ) }
157- </ select >
158- </ FlexBox . Column >
159- </ Box >
159+ { roles . map ( ( option ) => (
160+ < option key = { option . id } value = { option . id } >
161+ { option . name . toUpperCase ( ) }
162+ </ option >
163+ ) ) }
164+ </ select >
165+ </ FlexBox . Column >
166+ </ Box >
167+ ) }
160168
161169 { ! showTokField && (
162170 < Box style = { { width : '10%' , marginTop : '27px' } } marginLeft = "md" >
0 commit comments