added clearer error message
This commit is contained in:
parent
c3f0cb921c
commit
c4efbadf89
@ -84,7 +84,10 @@ export default function CreateCalendarEventModal() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (error["title"]) {
|
if (error["title"]) {
|
||||||
if (title) {
|
if (title) {
|
||||||
setError((prev) => ({ ...prev, title: undefined }));
|
setError((prev) => ({
|
||||||
|
...prev,
|
||||||
|
title: undefined,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [title, error]);
|
}, [title, error]);
|
||||||
@ -97,7 +100,7 @@ export default function CreateCalendarEventModal() {
|
|||||||
|
|
||||||
if (!title) {
|
if (!title) {
|
||||||
setError({
|
setError({
|
||||||
title: "Please add a title",
|
title: "Please add an event name",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -451,6 +454,9 @@ export default function CreateCalendarEventModal() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{!!error["title"] && (
|
||||||
|
<p className="text-sm text-destructive">{error["title"]}</p>
|
||||||
|
)}
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<Button
|
<Button
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user