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 ⭐️

589 B
Raw Blame
import {useMutation, useQueryClient} from "@tanstack/react-query";
import {IdParam} from "../types.ts";
import {organizerClient} from "../api/organizer.client.ts";
import {GET_ORGANIZERS_QUERY_KEY} from "../queries/useGetOrganizers.ts";

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

    return useMutation({
        mutationFn: ({organizerId}: { organizerId: IdParam }) => organizerClient.delete(organizerId),

        onSuccess: () => {
            return queryClient.invalidateQueries({queryKey: [GET_ORGANIZERS_QUERY_KEY]});
        }
    });
};