mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
feat: add acceptInviteMutationAtom
This commit is contained in:
parent
5e0bc3823c
commit
92e2414ff7
1 changed files with 17 additions and 0 deletions
|
|
@ -66,3 +66,20 @@ export const deleteInviteMutationAtom = atomWithMutation(() => ({
|
|||
toast.error("Failed to delete invite");
|
||||
},
|
||||
}));
|
||||
|
||||
/**
|
||||
* Mutation atom for accepting an invite
|
||||
*/
|
||||
export const acceptInviteMutationAtom = atomWithMutation(() => ({
|
||||
mutationFn: async (request: AcceptInviteRequest) => {
|
||||
return invitesApiService.acceptInvite(request);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["search-spaces"] });
|
||||
toast.success("Invite accepted successfully");
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
console.error("Error accepting invite:", error);
|
||||
toast.error("Failed to accept invite");
|
||||
},
|
||||
}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue