feat: add updateInviteMutationAtom for invite updates

This commit is contained in:
CREDO23 2025-12-16 16:10:12 +00:00
parent 3cd9018626
commit 9c22ae2da5

View file

@ -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");
},
}));