diff options
author | Vitaly Takmazov | 2022-11-08 00:17:14 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:58 +0300 |
commit | abe8e7bc26906929914834dbaf38a793bcbb4f78 (patch) | |
tree | 677b41bc2b3d2f78b26392dbf4bb7d7dddb603bb /vnext/src/ui/MessageInput.js | |
parent | ee4f45f13f652d8807c2617f24aa167243076b5e (diff) |
ESLint: switch to `@typescript-eslint/parser`
* JS version of the `no-floating-promise` rule sucks :(
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 ( |