add pending email cancel button

This commit is contained in:
Gregor Vostrak
2026-05-29 15:31:33 +02:00
committed by Constantin Graf
parent 734aab6353
commit 24c19e7e7c
4 changed files with 121 additions and 9 deletions

View File

@@ -93,3 +93,21 @@ export function useResendUserEmailVerificationMutation() {
},
});
}
export function useResetUserPendingEmailMutation() {
const queryClient = useQueryClient();
const { handleApiRequestNotifications } = useNotificationsStore();
return useMutation({
mutationFn: async (userId: string) => {
return handleApiRequestNotifications(
() => api.resetUserPendingEmail(undefined, { params: { user: userId } }),
'Email change canceled',
'Failed to cancel email change'
);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ME_QUERY_KEY });
},
});
}