@@ -18,6 +18,7 @@ import {
18
18
useListGroupMembersQuery ,
19
19
useListGroupOwnersQuery ,
20
20
useListGroupQuery ,
21
+ useListGroupSenderAuthQuery ,
21
22
} from 'src/store/api/groups'
22
23
import { useDispatch } from 'react-redux'
23
24
import { ModalService } from 'src/components/utilities'
@@ -41,6 +42,13 @@ const EditGroup = () => {
41
42
isSuccess,
42
43
} = useListGroupQuery ( { tenantDomain, groupId } )
43
44
45
+ const {
46
+ data : SenderAuth = { } ,
47
+ isFetching : SenderAuthisFetching ,
48
+ error : SenderAuthError ,
49
+ isSuccess : SenderAuthIsSuccess ,
50
+ } = useListGroupSenderAuthQuery ( { tenantDomain, groupId } )
51
+
44
52
const {
45
53
data : members = [ ] ,
46
54
isFetching : membersisFetching ,
@@ -68,6 +76,7 @@ const EditGroup = () => {
68
76
const [ genericPostRequest , postResults ] = useLazyGenericPostRequestQuery ( )
69
77
70
78
const [ roleInfo , setroleInfo ] = React . useState ( [ ] )
79
+ const [ allowExternal , setAllowExternal ] = useState ( false )
71
80
useEffect ( ( ) => {
72
81
if ( ownersIsSuccess && membersIsSuccess ) {
73
82
const ownerWithRole = owners . map ( ( owner ) => {
@@ -97,6 +106,13 @@ const EditGroup = () => {
97
106
setQueryError ( true )
98
107
}
99
108
} , [ groupId , tenantDomain , dispatch ] )
109
+
110
+ useEffect ( ( ) => {
111
+ if ( SenderAuthIsSuccess ) {
112
+ setAllowExternal ( ! SenderAuth ) // If SenderAuth is true, setAllowExternal to false, and vice versa
113
+ }
114
+ } , [ SenderAuthIsSuccess , SenderAuth ] )
115
+
100
116
const onSubmit = ( values ) => {
101
117
const shippedValues = {
102
118
tenantID : tenantDomain ,
@@ -154,6 +170,7 @@ const EditGroup = () => {
154
170
{ isSuccess && (
155
171
< Form
156
172
onSubmit = { onSubmit }
173
+ initialValues = { { allowExternal } }
157
174
render = { ( { handleSubmit, submitting, values } ) => {
158
175
return (
159
176
< CForm onSubmit = { handleSubmit } >
@@ -304,8 +321,18 @@ const EditGroup = () => {
304
321
{ isFetching && < CSpinner /> }
305
322
{ isSuccess && (
306
323
< >
307
- This is the (raw) information for this group.
308
- < pre > { JSON . stringify ( group , null , 2 ) } </ pre >
324
+ < div >
325
+ This is the (raw) information for this group.
326
+ < pre > { JSON . stringify ( group , null , 2 ) } </ pre >
327
+ </ div >
328
+ < div >
329
+ This is the (raw) information for SenderAuth.
330
+ { SenderAuthisFetching && < CSpinner /> }
331
+ { SenderAuthIsSuccess && < pre > { JSON . stringify ( SenderAuth , null , 2 ) } </ pre > }
332
+ { SenderAuthError && (
333
+ < div > Error fetching SenderAuth data: { SenderAuthError . message } </ div >
334
+ ) }
335
+ </ div >
309
336
</ >
310
337
) }
311
338
</ CCardBody >
0 commit comments