From 33e19d33183c93d6ec4fa290a714073e95c4e56b Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Fri, 28 Mar 2025 10:42:59 +0800 Subject: [PATCH] fix(form): show error message when input is empty before submitting form --- src/app/(app)/problems/[id]/@ai/@bot/page.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/(app)/problems/[id]/@ai/@bot/page.tsx b/src/app/(app)/problems/[id]/@ai/@bot/page.tsx index 7b87cff..7e10d13 100644 --- a/src/app/(app)/problems/[id]/@ai/@bot/page.tsx +++ b/src/app/(app)/problems/[id]/@ai/@bot/page.tsx @@ -28,7 +28,10 @@ export default function AiBotPage() { const handleFormSubmit = useCallback( (e: React.FormEvent) => { e.preventDefault(); - if (!input.trim()) return; + if (!input.trim()) { + toast.error("Input cannot be empty"); + return; + } const currentCodeMessage = { id: problemId,