-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ability for admins to manage granular permissions
- Loading branch information
Showing
11 changed files
with
233 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
apps/web/src/features/admin/hooks/useUpdateUserMutation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks'; | ||
import type { UpdateUserData } from '@opendatacapture/schemas/user'; | ||
import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
import axios from 'axios'; | ||
|
||
export function useUpdateUserMutation() { | ||
const queryClient = useQueryClient(); | ||
const addNotification = useNotificationsStore((store) => store.addNotification); | ||
return useMutation({ | ||
mutationFn: async ({ data, id }: { data: UpdateUserData; id: string }) => { | ||
await axios.patch(`/v1/users/${id}`, data); | ||
}, | ||
onSuccess() { | ||
addNotification({ type: 'success' }); | ||
void queryClient.invalidateQueries({ queryKey: ['users'] }); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "opendatacapture", | ||
"type": "module", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"private": true, | ||
"packageManager": "[email protected]", | ||
"license": "Apache-2.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.