Hi,
I'm trying to update startDate & endDate of my bookings in Calendar when I drag them, but right now even console.log doesn't run during tests. I want to run my update function when I finish dragging.
My Calendar Declaration:
const Calendar = () => {
const { props } = useBryntumProps()
return (
<>
<BryntumCalendar {...props} />
<BookingModal />
</>
)
}
useBryntumProps(in shortcut):
export const useBryntumProps = () => {
//rest of implementation
const dragFeature = useDragEvent()
const props = {
...bryntumProps,
listeners,
eventMenuFeature,
eventStore,
eventTooltipFeature,
resourceStore,
assignmentStore,
dragFeature
}
return {
isLoading,
props,
}
}
and in useDragEvent:
export const useDragEvent = () => {
const { update, isPending } = useMutate<BookingFromBackend>({
endpoint: "/bookings",
options: {
queryKeysToInvalidate: [["bookings"]],
},
})
const onDragMoveEnd = (data) => {
console.log("Drag moving");
const updateData = {
startDate: startDate.toISOString(),
endDate: endDate.toISOString(),
resourceId: resourceRecord?.id,
};
update({
id: bookingId,
update: updateData,
});
}
return true;
};
return {
onDragMoveEnd,
isPending
};
}
I'm not sure if I should use onDragMoveEnd or something else, so I'd also appreciate some information.