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