mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
feat: add updateInviteMutationAtom for invite updates
This commit is contained in:
parent
3cd9018626
commit
9c22ae2da5
1 changed files with 19 additions and 0 deletions
|
|
@ -28,3 +28,22 @@ export const createInviteMutationAtom = atomWithMutation(() => ({
|
|||
toast.error("Failed to create invite");
|
||||
},
|
||||
}));
|
||||
|
||||
/**
|
||||
* Mutation atom for updating an invite
|
||||
*/
|
||||
export const updateInviteMutationAtom = atomWithMutation(() => ({
|
||||
mutationFn: async (request: UpdateInviteRequest) => {
|
||||
return invitesApiService.updateInvite(request);
|
||||
},
|
||||
onSuccess: (_, variables) => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: cacheKeys.invites.all(variables.search_space_id.toString()),
|
||||
});
|
||||
toast.success("Invite updated successfully");
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
console.error("Error updating invite:", error);
|
||||
toast.error("Failed to update invite");
|
||||
},
|
||||
}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue