Skip to content

Commit

Permalink
fix: edit group (#3856)
Browse files Browse the repository at this point in the history
Co-authored-by: kyle-ssg <[email protected]>
  • Loading branch information
matthewelwell and kyle-ssg authored Apr 30, 2024
1 parent bbf82f9 commit b25e6f8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
16 changes: 13 additions & 3 deletions frontend/common/services/useGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export const groupService = service
.injectEndpoints({
endpoints: (builder) => ({
createGroup: builder.mutation<Res['group'], Req['createGroup']>({
invalidatesTags: [{ id: 'LIST', type: 'Group' }],
invalidatesTags: [
{ id: 'LIST', type: 'Group' },
{ type: 'GroupSummary' },
],
queryFn: async (query, { dispatch }, _, baseQuery) => {
//Create the group
const { data, error } = await baseQuery({
Expand Down Expand Up @@ -47,7 +50,10 @@ export const groupService = service
Res['groupAdmin'],
Req['createGroupAdmin']
>({
invalidatesTags: [{ id: 'LIST', type: 'Group' }],
invalidatesTags: [
{ id: 'LIST', type: 'Group' },
{ type: 'GroupSummary' },
],
query: (query: Req['createGroupAdmin']) => ({
body: {},
method: 'POST',
Expand All @@ -70,7 +76,10 @@ export const groupService = service
Res['groupAdmin'],
Req['deleteGroupAdmin']
>({
invalidatesTags: [{ id: 'LIST', type: 'Group' }],
invalidatesTags: [
{ id: 'LIST', type: 'Group' },
{ type: 'GroupSummary' },
],
query: (query: Req['deleteGroupAdmin']) => ({
body: {},
method: 'POST',
Expand All @@ -93,6 +102,7 @@ export const groupService = service
invalidatesTags: (res) => [
{ id: 'LIST', type: 'Group' },
{ id: res?.id, type: 'Group' },
{ type: 'GroupSummary' },
],
queryFn: async (query, { dispatch }, _, baseQuery) => {
//Create the group
Expand Down
5 changes: 4 additions & 1 deletion frontend/web/components/UserGroupList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ const UserGroupsRow: FC<UserGroupsRowType> = ({
<Button
id='remove-group'
type='button'
onClick={() => removeGroup(id, name)}
onClick={(e) => {
e.stopPropagation()
removeGroup(id, name)
}}
className='btn btn-with-icon'
>
<Icon name='trash-2' width={20} fill='#656D7B' />
Expand Down
5 changes: 1 addition & 4 deletions frontend/web/components/modals/CreateGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,6 @@ const CreateGroup: FC<CreateGroupType> = ({ group, orgId, roles }) => {
)}
</div>
)
if (error) {
return
}
return isEdit ? (
<Tabs uncontrolled tabClassName='px-0'>
<TabItem
Expand All @@ -466,7 +463,7 @@ const CreateGroup: FC<CreateGroupType> = ({ group, orgId, roles }) => {
<TabItem tabLabel={<div>Permissions</div>}>{editPermissionsEl}</TabItem>
</Tabs>
) : (
editGroup
editGroupEl
)
}

Expand Down

0 comments on commit b25e6f8

Please sign in to comment.