Locations added
This commit is contained in:
@@ -8,6 +8,7 @@ import { createEventsServicePlugin } from "@schedule-x/events-service";
|
||||
import { createDragAndDropPlugin } from "@schedule-x/drag-and-drop";
|
||||
import { createResizePlugin } from "@schedule-x/resize";
|
||||
import { createEventRecurrencePlugin } from "@schedule-x/event-recurrence";
|
||||
import { createEventModalPlugin } from "@schedule-x/event-modal";
|
||||
import {
|
||||
createViewDay,
|
||||
createViewWeek,
|
||||
@@ -50,6 +51,8 @@ const Planning: React.FC<{
|
||||
if (isConnected && modifiable) {
|
||||
plugins.push(createDragAndDropPlugin());
|
||||
plugins.push(createResizePlugin());
|
||||
} else if (isConnected || !isConnected) {
|
||||
plugins.push(createEventModalPlugin());
|
||||
}
|
||||
const [eventSelected, setEventSelected] = useState<ICalendarEvent | null>(
|
||||
null,
|
||||
@@ -60,6 +63,7 @@ const Planning: React.FC<{
|
||||
|
||||
const handleEventUpdate = async (
|
||||
eventSelected: ICalendarEvent | Omit<ICalendarEvent, "id">,
|
||||
willMutate: boolean = false,
|
||||
) => {
|
||||
if (!isConnected || !modifiable) return;
|
||||
const event = {
|
||||
@@ -80,7 +84,7 @@ const Planning: React.FC<{
|
||||
description: res.message,
|
||||
});
|
||||
} else {
|
||||
// mutate?.();
|
||||
willMutate && mutate?.();
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof Error)
|
||||
@@ -176,6 +180,8 @@ const Planning: React.FC<{
|
||||
fullday: formValues.fullDay,
|
||||
rrule: rrule,
|
||||
isVisible: formValues.isVisible,
|
||||
description: formValues.description,
|
||||
location: formValues.location,
|
||||
};
|
||||
const res = await request<undefined>(`/events/new`, {
|
||||
method: "POST",
|
||||
@@ -260,8 +266,10 @@ const Planning: React.FC<{
|
||||
fullday: formValues.fullDay,
|
||||
rrule: rrule,
|
||||
isVisible: formValues.isVisible,
|
||||
description: formValues.description,
|
||||
location: formValues.location,
|
||||
};
|
||||
await handleEventUpdate(event);
|
||||
await handleEventUpdate(event, true);
|
||||
setEventSelected(null);
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user