Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

686 B
Raw Blame
import {useMutation, useQueryClient} from "@tanstack/react-query";
import {accountClient} from "../api/account.client.ts";
import {GET_ACCOUNT_QUERY_KEY} from "../queries/useGetAccount.ts";
import {GET_ACCOUNT_DELETION_STATUS_QUERY_KEY} from "../queries/useGetAccountDeletionStatus.ts";

export const useCancelAccountDeletion = () => {
    const queryClient = useQueryClient();

    return useMutation({
        mutationFn: () => accountClient.cancelDeletion(),

        onSuccess: () => {
            queryClient.invalidateQueries({queryKey: [GET_ACCOUNT_QUERY_KEY]});
            queryClient.invalidateQueries({queryKey: [GET_ACCOUNT_DELETION_STATUS_QUERY_KEY]});
        }
    });
}