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 ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
import {useMutation, useQueryClient} from "@tanstack/react-query";
import {IdParam} from "../types.ts";
import {attendeesClient, EditAttendeeRequest} from "../api/attendee.client.ts";
import {GET_ATTENDEES_QUERY_KEY} from "../queries/useGetAttendees.ts";
import {GET_EVENT_COUNTS_QUERY_KEY} from "../queries/useGetEventCounts.ts";
import {GET_OCCUPIED_SEATS_QUERY_KEY} from "../ee/seating/queries/useGetOccupiedSeats.ts";
import {GET_SEAT_AVAILABILITY_QUERY_KEY} from "../ee/seating/queries/useGetSeatAvailability.ts";
export const useModifyAttendee = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({attendeeId, attendeeData, eventId}: {
attendeeId: IdParam,
eventId: IdParam,
attendeeData: Partial<EditAttendeeRequest>,
}) => attendeesClient.modify(eventId, attendeeId, attendeeData),
onSuccess: () => Promise.all([
queryClient.invalidateQueries({queryKey: [GET_ATTENDEES_QUERY_KEY]}),
queryClient.invalidateQueries({queryKey: [GET_EVENT_COUNTS_QUERY_KEY]}),
queryClient.invalidateQueries({queryKey: [GET_OCCUPIED_SEATS_QUERY_KEY]}),
queryClient.invalidateQueries({queryKey: [GET_SEAT_AVAILABILITY_QUERY_KEY]}),
])
});
}