change: form actions to safe client side handlers

This commit is contained in:
Mahyar Khanbolooki
2025-08-09 15:10:02 +03:30
parent f7eb07cc13
commit bb73e3ff6f
3 changed files with 15 additions and 9 deletions
+4 -2
View File
@@ -42,7 +42,9 @@ function ChatIndex({ }: Props) {
})
}
const submitMessage = async (formData: FormData) => {
const submitMessage = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const formData = new FormData(e.currentTarget);
const content = formData.get('textMessage');
if (!content) return;
const model: MessageModel = {
@@ -105,7 +107,7 @@ function ChatIndex({ }: Props) {
<section aria-labelledby={t("InputMessage.AriaLabelBy")} className="w-full">
<form
action={submitMessage}
onSubmit={submitMessage}
className="focus-within:outline-blue-400 outline outline-transparent transition-colors duration-100 flex items-center gap-0 bg-transparent border border-[#D0D0D0] h-12 rounded-xl py-2.5 px-2"
>
<button type="button" className="active:bg-neutral-100 transition-colors duration-150 rounded-full p-1">