[#7] fixed state update when moving event from calednars
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
|||||||
deleteEventAsync,
|
deleteEventAsync,
|
||||||
moveEventAsync,
|
moveEventAsync,
|
||||||
putEventAsync,
|
putEventAsync,
|
||||||
|
removeEvent,
|
||||||
} from "../Calendars/CalendarSlice";
|
} from "../Calendars/CalendarSlice";
|
||||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||||
import AttendeeSelector from "../../components/Attendees/AttendeeSearch";
|
import AttendeeSelector from "../../components/Attendees/AttendeeSearch";
|
||||||
@@ -134,7 +135,7 @@ export default function EventDisplayModal({
|
|||||||
dispatch(putEventAsync({ cal: calendar, newEvent }));
|
dispatch(putEventAsync({ cal: calendar, newEvent }));
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = async () => {
|
||||||
const newEventUID = crypto.randomUUID();
|
const newEventUID = crypto.randomUUID();
|
||||||
|
|
||||||
const newEvent: CalendarEvent = {
|
const newEvent: CalendarEvent = {
|
||||||
@@ -166,7 +167,7 @@ export default function EventDisplayModal({
|
|||||||
color: userPersonnalCalendars[calendarid]?.color,
|
color: userPersonnalCalendars[calendarid]?.color,
|
||||||
};
|
};
|
||||||
|
|
||||||
dispatch(
|
await dispatch(
|
||||||
putEventAsync({
|
putEventAsync({
|
||||||
cal: userPersonnalCalendars[calendarid],
|
cal: userPersonnalCalendars[calendarid],
|
||||||
newEvent,
|
newEvent,
|
||||||
@@ -181,6 +182,7 @@ export default function EventDisplayModal({
|
|||||||
newURL: `/calendars/${newCalId}/${event.uid}.ics`,
|
newURL: `/calendars/${newCalId}/${event.uid}.ics`,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
dispatch(removeEvent({ calendarUid: calId, eventUid: event.uid }));
|
||||||
}
|
}
|
||||||
onClose({}, "backdropClick");
|
onClose({}, "backdropClick");
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user