diff options
Diffstat (limited to 'vnext/src/ui/MessageInput.js')
-rw-r--r-- | vnext/src/ui/MessageInput.js | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/vnext/src/ui/MessageInput.js b/vnext/src/ui/MessageInput.js index aa4454a1..de4edc7f 100644 --- a/vnext/src/ui/MessageInput.js +++ b/vnext/src/ui/MessageInput.js @@ -89,25 +89,27 @@ export default function MessageInput({ text, rows, placeholder, onSend }) { let uploadValueChanged = (attach) => { setAttach(attach); }; - let onSubmit = async (event) => { + let onSubmit = (event) => { if (event.preventDefault) { event.preventDefault(); } const input = fileinput.current; if (input && input.files) { - if (await onSend({ + onSend({ body: body, attach: attach ? input.files[0] : '' - })) { - setAttach(''); - setBody(''); - if (textareaRef.current) { - textareaRef.current.style.height = ''; + }).then((success) => { + if (success) { + setAttach(''); + setBody(''); + if (textareaRef.current) { + textareaRef.current.style.height = ''; + } + updateFocus(); + } else { + toast('Can not update this message'); } - updateFocus(); - } else { - toast('Can not update this message'); - } + }).catch(console.log); } }; return ( |