Skip to content

Commit

Permalink
add refresh to groups
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Sep 26, 2023
1 parent a28bc05 commit 7b48299
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/views/identity/administration/EditGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ const EditGroup = () => {
let query = useQuery()
const groupId = query.get('groupId')
const tenantDomain = query.get('tenantDomain')

const [queryError, setQueryError] = useState(false)

const [refreshToken, setRefresh] = useState('')
const {
data: group = {},
isFetching,
Expand All @@ -47,14 +46,14 @@ const EditGroup = () => {
isFetching: membersisFetching,
error: membersError,
isSuccess: membersIsSuccess,
} = useListGroupMembersQuery({ tenantDomain, groupId })
} = useListGroupMembersQuery({ tenantDomain, groupId, refreshToken })

const {
data: owners = [],
isFetching: ownersisFetching,
error: ownersError,
isSuccess: ownersIsSuccess,
} = useListGroupOwnersQuery({ tenantDomain, groupId })
} = useListGroupOwnersQuery({ tenantDomain, groupId, refreshToken })
const {
data: users = [],
isFetching: usersIsFetching,
Expand All @@ -66,6 +65,7 @@ const EditGroup = () => {
isFetching: contactsIsFetching,
error: contactsError,
} = useListContactsQuery({ tenantDomain })
const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()

const [roleInfo, setroleInfo] = React.useState([])
useEffect(() => {
Expand All @@ -86,7 +86,7 @@ const EditGroup = () => {
})
setroleInfo(ownerWithRole.concat(memberwithRole))
}
}, [owners, members, ownersIsSuccess, membersIsSuccess])
}, [owners, members, ownersIsSuccess, membersIsSuccess, postResults])

useEffect(() => {
if (!groupId || !tenantDomain) {
Expand All @@ -97,7 +97,6 @@ const EditGroup = () => {
setQueryError(true)
}
}, [groupId, tenantDomain, dispatch])
const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()
const onSubmit = (values) => {
const shippedValues = {
tenantID: tenantDomain,
Expand All @@ -114,7 +113,9 @@ const EditGroup = () => {
mail: group[0].mail,
}
//window.alert(JSON.stringify(shippedValues))
genericPostRequest({ path: '/api/EditGroup', values: shippedValues })
genericPostRequest({ path: '/api/EditGroup', values: shippedValues }).then((res) => {
setRefresh(postResults.requestId)
})
}
const tableColumns = [
{
Expand Down

0 comments on commit 7b48299

Please sign in to comment.