Skip to content

Commit b486515

Browse files
committed
EditGroupChanges
1 parent 012ce84 commit b486515

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

src/store/api/groups.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ export const groupsApi = baseApi.injectEndpoints({
5959
params: { tenantFilter: tenantDomain, userId },
6060
}),
6161
}),
62+
listGroupSenderAuth: builder.query({
63+
query: ({ tenantDomain, groupId }) => ({
64+
path: '/api/ListGroupSenderAuthentication',
65+
params: {
66+
TenantFilter: tenantDomain,
67+
GroupId: groupId,
68+
},
69+
}),
70+
}),
6271
}),
6372
})
6473
export const {
@@ -69,4 +78,5 @@ export const {
6978
useListGroupMembersQuery,
7079
useListGroupOwnersQuery,
7180
useListUserGroupsQuery,
81+
useListGroupSenderAuthQuery,
7282
} = groupsApi

src/views/identity/administration/EditGroup.jsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
useListGroupMembersQuery,
1919
useListGroupOwnersQuery,
2020
useListGroupQuery,
21+
useListGroupSenderAuthQuery,
2122
} from 'src/store/api/groups'
2223
import { useDispatch } from 'react-redux'
2324
import { ModalService } from 'src/components/utilities'
@@ -41,6 +42,13 @@ const EditGroup = () => {
4142
isSuccess,
4243
} = useListGroupQuery({ tenantDomain, groupId })
4344

45+
const {
46+
data: SenderAuth = {},
47+
isFetching: SenderAuthisFetching,
48+
error: SenderAuthError,
49+
isSuccess: SenderAuthIsSuccess,
50+
} = useListGroupSenderAuthQuery({ tenantDomain, groupId })
51+
4452
const {
4553
data: members = [],
4654
isFetching: membersisFetching,
@@ -68,6 +76,7 @@ const EditGroup = () => {
6876
const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()
6977

7078
const [roleInfo, setroleInfo] = React.useState([])
79+
const [allowExternal, setAllowExternal] = useState(false)
7180
useEffect(() => {
7281
if (ownersIsSuccess && membersIsSuccess) {
7382
const ownerWithRole = owners.map((owner) => {
@@ -97,6 +106,13 @@ const EditGroup = () => {
97106
setQueryError(true)
98107
}
99108
}, [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+
100116
const onSubmit = (values) => {
101117
const shippedValues = {
102118
tenantID: tenantDomain,
@@ -154,6 +170,7 @@ const EditGroup = () => {
154170
{isSuccess && (
155171
<Form
156172
onSubmit={onSubmit}
173+
initialValues={{ allowExternal }}
157174
render={({ handleSubmit, submitting, values }) => {
158175
return (
159176
<CForm onSubmit={handleSubmit}>
@@ -304,8 +321,18 @@ const EditGroup = () => {
304321
{isFetching && <CSpinner />}
305322
{isSuccess && (
306323
<>
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>
309336
</>
310337
)}
311338
</CCardBody>

0 commit comments

Comments
 (0)