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 {eventsClient} from "../api/event.client.ts";
import {useMutation, useQueryClient} from "@tanstack/react-query";
import {EventType, IdParam} from "../types.ts";
import {GET_EVENT_QUERY_KEY} from "../queries/useGetEvent.ts";
import {GET_EVENTS_QUERY_KEY} from "../queries/useGetEvents.ts";
import {GET_EVENT_PUBLIC_QUERY_KEY} from "../queries/useGetEventPublic.ts";
import {GET_EVENT_OCCURRENCES_QUERY_KEY} from "../queries/useGetEventOccurrences.ts";
export const useUpdateEventType = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({eventId, type}: {
eventId: IdParam,
type: EventType,
}) => eventsClient.updateEventType(eventId, type),
onSuccess: (_, variables) => {
return Promise.all([
queryClient.invalidateQueries({
queryKey: [GET_EVENT_QUERY_KEY, variables.eventId]
}),
queryClient.invalidateQueries({
queryKey: [GET_EVENT_PUBLIC_QUERY_KEY, variables.eventId]
}),
queryClient.invalidateQueries({
queryKey: [GET_EVENT_OCCURRENCES_QUERY_KEY, variables.eventId]
}),
queryClient.invalidateQueries({
queryKey: [GET_EVENTS_QUERY_KEY]
}),
]);
}
});
}