Make rescheduler actually work kekw
This commit is contained in:
@ -355,8 +355,9 @@ export default function () {
|
|||||||
const newDate = (
|
const newDate = (
|
||||||
document.getElementById("reschedule-input") as HTMLInputElement
|
document.getElementById("reschedule-input") as HTMLInputElement
|
||||||
).value;
|
).value;
|
||||||
|
const day = newDate.split("-").at(2);
|
||||||
const rescheduleResp = await fetch(`/api/events-team/events/${eventId}`, {
|
const rescheduleResp = await fetch(`/api/events-team/events/${eventId}`, {
|
||||||
body: JSON.stringify({ day: newDate.split("-").at(2) }),
|
body: JSON.stringify({ day }),
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
},
|
},
|
||||||
@ -379,6 +380,11 @@ export default function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const newEventData = eventData;
|
||||||
|
newEventData[eventData.findIndex((e) => e.id === eventId)].day = day;
|
||||||
|
|
||||||
|
setEventData([...newEventData]);
|
||||||
|
setSelectedEvent("");
|
||||||
onRescheduleClose();
|
onRescheduleClose();
|
||||||
toast({
|
toast({
|
||||||
description: `Event rescheduled to ${newDate}`,
|
description: `Event rescheduled to ${newDate}`,
|
||||||
@ -527,7 +533,11 @@ export default function () {
|
|||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button onClick={onRescheduleClose}>Cancel</Button>
|
<Button onClick={onRescheduleClose}>Cancel</Button>
|
||||||
<Button colorScheme="blue" ml="8px">
|
<Button
|
||||||
|
colorScheme="blue"
|
||||||
|
ml="8px"
|
||||||
|
onClick={async () => await reschedule(selectedEvent)}
|
||||||
|
>
|
||||||
Reschedule
|
Reschedule
|
||||||
</Button>
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
|
Reference in New Issue
Block a user