Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make rescheduler actually work kekw
  • Loading branch information
regalijan committed Oct 21, 2024
1 parent ea281a7 commit d645176
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/routes/events-team.tsx
Expand Up @@ -355,8 +355,9 @@ export default function () {
const newDate = (
document.getElementById("reschedule-input") as HTMLInputElement
).value;
const day = newDate.split("-").at(2);
const rescheduleResp = await fetch(`/api/events-team/events/${eventId}`, {
body: JSON.stringify({ day: newDate.split("-").at(2) }),
body: JSON.stringify({ day }),
headers: {
"content-type": "application/json",
},
Expand All @@ -379,6 +380,11 @@ export default function () {
return;
}

const newEventData = eventData;
newEventData[eventData.findIndex((e) => e.id === eventId)].day = day;

setEventData([...newEventData]);
setSelectedEvent("");
onRescheduleClose();
toast({
description: `Event rescheduled to ${newDate}`,
Expand Down Expand Up @@ -527,7 +533,11 @@ export default function () {
</ModalBody>
<ModalFooter>
<Button onClick={onRescheduleClose}>Cancel</Button>
<Button colorScheme="blue" ml="8px">
<Button
colorScheme="blue"
ml="8px"
onClick={async () => await reschedule(selectedEvent)}
>
Reschedule
</Button>
</ModalFooter>
Expand Down

0 comments on commit d645176

Please sign in to comment.