Don't send empty dates
This commit is contained in:
parent
8c32cd121d
commit
3d8ce8356f
@ -348,7 +348,18 @@ 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 day = parseInt(newDate.split("-").at(2) ?? "");
|
||||||
|
|
||||||
|
if (isNaN(day)) {
|
||||||
|
toast({
|
||||||
|
description: "Please select a date, then try again.",
|
||||||
|
status: "error",
|
||||||
|
title: "No date selected",
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const rescheduleResp = await fetch(`/api/events-team/events/${eventId}`, {
|
const rescheduleResp = await fetch(`/api/events-team/events/${eventId}`, {
|
||||||
body: JSON.stringify({ day }),
|
body: JSON.stringify({ day }),
|
||||||
headers: {
|
headers: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user