From abe8e7bc26906929914834dbaf38a793bcbb4f78 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Tue, 8 Nov 2022 00:17:14 +0300
Subject: ESLint: switch to `@typescript-eslint/parser`
* JS version of the `no-floating-promise` rule sucks :(
---
vnext/src/ui/Chat.js | 2 +-
vnext/src/ui/Contacts.js | 2 +-
vnext/src/ui/Icon.js | 1 -
vnext/src/ui/MessageInput.js | 24 +++++++++++++-----------
vnext/src/ui/Settings.js | 10 +++++-----
vnext/src/ui/UserInfo.js | 3 +--
6 files changed, 21 insertions(+), 21 deletions(-)
(limited to 'vnext/src')
diff --git a/vnext/src/ui/Chat.js b/vnext/src/ui/Chat.js
index 0f8f53ba..f7113aaa 100644
--- a/vnext/src/ui/Chat.js
+++ b/vnext/src/ui/Chat.js
@@ -34,7 +34,7 @@ export default function Chat(props) {
getChat(uname)
.then(response => {
setChats(response.data);
- });
+ }).catch(console.log);
}
}, []);
diff --git a/vnext/src/ui/Contacts.js b/vnext/src/ui/Contacts.js
index 07e4dfc4..b1f87723 100644
--- a/vnext/src/ui/Contacts.js
+++ b/vnext/src/ui/Contacts.js
@@ -16,7 +16,7 @@ export default function Contacts() {
getChats()
.then(response => {
setPms(response.data.pms);
- });
+ }).catch(console.log);
}, []);
return (
diff --git a/vnext/src/ui/Icon.js b/vnext/src/ui/Icon.js
index acf7bccf..a9cd8a95 100644
--- a/vnext/src/ui/Icon.js
+++ b/vnext/src/ui/Icon.js
@@ -1,7 +1,6 @@
import { createElement, memo } from 'react';
import PropTypes from 'prop-types';
-// @ts-ignore
import evilIcons from 'evil-icons/assets/sprite.svg';
/**
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 (
diff --git a/vnext/src/ui/Settings.js b/vnext/src/ui/Settings.js
index 82fbcc9e..6e9d4f36 100644
--- a/vnext/src/ui/Settings.js
+++ b/vnext/src/ui/Settings.js
@@ -40,8 +40,8 @@ function ChangeAvatarForm({ onChange }) {
avatarChanged('');
me().then(visitor => {
onChange(visitor);
- });
- });
+ }).catch(console.error);
+ }).catch(console.error);
};
return (