From 69c7b7123775205716e93044d19f5e53cb2e2978 Mon Sep 17 00:00:00 2001
From: Fedor Katurov <gotham48@gmail.com>
Date: Wed, 9 Oct 2019 21:24:13 +0700
Subject: [PATCH] cleanup

---
 .eslintrc.js                              |  1 +
 src/components/node/CommentForm/index.tsx | 11 ++---------
 src/redux/uploads/sagas.ts                |  5 ++---
 src/utils/uploader.ts                     |  6 ++++--
 4 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/.eslintrc.js b/.eslintrc.js
index 83f07183..0b5c9787 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -83,5 +83,6 @@ module.exports = {
     HTMLInputElement: false,
     HTMLDivElement: false,
     FormData: false,
+    FileReader: false,
   },
 };
diff --git a/src/components/node/CommentForm/index.tsx b/src/components/node/CommentForm/index.tsx
index 24673dc7..355f6a28 100644
--- a/src/components/node/CommentForm/index.tsx
+++ b/src/components/node/CommentForm/index.tsx
@@ -11,7 +11,7 @@ import * as NODE_ACTIONS from '~/redux/node/actions';
 import { selectNode } from '~/redux/node/selectors';
 import { LoaderCircle } from '~/components/input/LoaderCircle';
 import { Group } from '~/components/containers/Group';
-import { UPLOAD_SUBJECTS, UPLOAD_TARGETS, UPLOAD_TYPES } from '~/redux/uploads/constants';
+import { UPLOAD_SUBJECTS, UPLOAD_TARGETS } from '~/redux/uploads/constants';
 import uuid from 'uuid4';
 import * as UPLOAD_ACTIONS from '~/redux/uploads/actions';
 import { selectUploads } from '~/redux/uploads/selectors';
@@ -149,14 +149,7 @@ const CommentFormUnconnected: FC<IProps> = ({
           )
       )}
 
-      {comment.files.map(
-        file =>
-          file.name && (
-            <div key={file.id}>
-              [{file.mime}] {file.name}
-            </div>
-          )
-      )}
+      {comment.files.map(file => file.name && <div key={file.id}>{file.name}</div>)}
     </CommentWrapper>
   );
 };
diff --git a/src/redux/uploads/sagas.ts b/src/redux/uploads/sagas.ts
index d5472f9b..357852e8 100644
--- a/src/redux/uploads/sagas.ts
+++ b/src/redux/uploads/sagas.ts
@@ -11,7 +11,6 @@ import {
 import { reqWrapper } from '../auth/sagas';
 import { createUploader, uploadGetThumb } from '~/utils/uploader';
 import { HTTP_RESPONSES } from '~/utils/api';
-import { VALIDATORS } from '~/utils/validators';
 import { IFileWithUUID, IFile, IUploadProgressHandler } from '../types';
 
 function* uploadCall({
@@ -97,13 +96,13 @@ function* uploadFile({ file, temp_id, type, target }: IFileWithUUID) {
     // add here CANCEL_UPLOADS worker, that will watch for subject
     // cancel_editing: take(UPLOAD_ACTIONS.CANCEL_EDITING),
     // save_inventory: take(INVENTORY_ACTIONS.SAVE_INVENTORY),
-  }) as any;
+  });
 
   if (cancel || cancel_editing) {
     return yield put(uploadDropStatus(temp_id));
   }
 
-  const { data, error }: { data: IFile & { detail: any }; error: string } = result;
+  const { data, error }: { data: IFile & { detail: string }; error: string } = result;
 
   if (error) {
     return yield put(
diff --git a/src/utils/uploader.ts b/src/utils/uploader.ts
index 1326bc6e..f161cd66 100644
--- a/src/utils/uploader.ts
+++ b/src/utils/uploader.ts
@@ -33,11 +33,13 @@ export function createUploader<T extends {}, R extends {}>(
 export const uploadGetThumb = async file => {
   if (!file.type || !VALIDATORS.IS_IMAGE_MIME(file.type)) return '';
 
-  return await new Promise((resolve, reject) => {
+  const thumb = await new Promise(resolve => {
     const reader = new FileReader();
     reader.onloadend = () => resolve(reader.result || '');
     reader.readAsDataURL(file);
   });
+
+  return thumb;
 };
 
 export const fakeUploader = ({
@@ -49,7 +51,7 @@ export const fakeUploader = ({
   onProgress: (current: number, total: number) => void;
   mustSucceed: boolean;
 }): Promise<IResultWithStatus<IFile>> => {
-  const { url, error } = file;
+  const { error } = file;
 
   return new Promise((resolve, reject) => {
     setTimeout(() => {