) {
event.preventDefault();
setLoading(true);
setError(null);
+ const fileIds = pickerRef.current?.getFileIds() ?? [];
const res = await fetch(
`/api/projects/${projectId}/board/threads/${threadId}/comments`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ bodyMd }),
+ body: JSON.stringify({ bodyMd, fileIds }),
}
);
setLoading(false);
if (res.ok) {
setBodyMd('');
+ pickerRef.current?.clear();
router.refresh();
} else {
const b = (await res.json().catch(() => null)) as {
@@ -48,6 +54,11 @@ export function CommentForm({
className="min-h-[80px] w-full rounded border px-3 py-2"
required
/>
+
{error && (
{error}
@@ -55,7 +66,7 @@ export function CommentForm({
)}