From fe82b4e0ef835e6921575f1927174479bea7f777 Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Tue, 17 Nov 2020 15:49:05 +0300 Subject: fix: clear eslint errors --- src/containers/AvatarCropModal/AvatarCropModal.tsx | 8 ++++---- src/containers/PollCreation/PollCreation.tsx | 4 ++-- src/containers/Profile/ProfileInfo.tsx | 16 +++++++++------- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/containers') diff --git a/src/containers/AvatarCropModal/AvatarCropModal.tsx b/src/containers/AvatarCropModal/AvatarCropModal.tsx index 4decdfb..e5fcc08 100644 --- a/src/containers/AvatarCropModal/AvatarCropModal.tsx +++ b/src/containers/AvatarCropModal/AvatarCropModal.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { makeStyles } from '@material-ui/core/styles'; -import SendIcon from "@material-ui/icons/Send"; -import { getCroppedImg } from './canvasUtils' +import SendIcon from '@material-ui/icons/Send'; +import { getCroppedImg } from './canvasUtils'; import ImageCropAreaSelect from '../../components/ImageCropAreaSelect/ImageCropAreaSelect'; import ModalScreen from '../../components/ModalScreen/ModalScreen'; @@ -26,7 +26,7 @@ const useStyles = makeStyles(theme => ({ // background: '#333', [theme.breakpoints.up('sm')]: { // height: 400, - }, + } } })); @@ -51,7 +51,7 @@ const AvatarCropModal: React.FC = ({ avatar, callback }) => { /> - ) + ); }; export default AvatarCropModal; diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx index 46ab28d..0a7e78d 100644 --- a/src/containers/PollCreation/PollCreation.tsx +++ b/src/containers/PollCreation/PollCreation.tsx @@ -1,9 +1,10 @@ -import React, {ChangeEvent, useState, useMemo, useCallback} from 'react'; +import React, { ChangeEvent, useState, useMemo, useCallback } from 'react'; import Bluebird from 'bluebird'; import { makeStyles } from '@material-ui/core/styles'; import { Card, Container, LinearProgress, InputBase, Typography } from '@material-ui/core'; import SendIcon from '@material-ui/icons/Send'; import { useSnackbar } from 'notistack'; +import { useHistory } from 'react-router'; import useS3Preupload from './useS3Preupload'; import ImageInput from './ImageInput'; @@ -13,7 +14,6 @@ import UserStrip from '../../components/UserStrip/UserStrip'; import { post } from '../../requests'; import { useFeed, useProfile } from '../../hooks/APIClient'; import { useAuth } from '../../hooks/useAuth'; -import {useHistory} from "react-router"; const useStyles = makeStyles(theme => ({ images: { diff --git a/src/containers/Profile/ProfileInfo.tsx b/src/containers/Profile/ProfileInfo.tsx index 4c9f17e..777a779 100644 --- a/src/containers/Profile/ProfileInfo.tsx +++ b/src/containers/Profile/ProfileInfo.tsx @@ -112,21 +112,23 @@ const ProfileInfo: React.FC = ({ const dateSince = useMemo(() => formatDate(userInfo?.createdAt), [userInfo]); const handleUpdateAvatar = useCallback(async (file: File) => { - if (user) uploadFileToS3(file, 0.8, setProgress) - .then(avatarUrl => patch(`/users/${user._id}`, { avatarUrl })) - .then(response => setUserInfo(response.data)) - .then(() => setProgress(0)); + if (user) { + uploadFileToS3(file, 0.8, setProgress) + .then(avatarUrl => patch(`/users/${user._id}`, { avatarUrl })) + .then(response => setUserInfo(response.data)) + .then(() => setProgress(0)); + } }, [user, setUserInfo]); - const handleCropAvatar = useCallback( async(file: File) => { + const handleCropAvatar = useCallback(async (file: File) => { const imageSrc = URL.createObjectURL(file); setAvatarToCrop(imageSrc); - },[]); + }, []); return (
{ - avatarToCrop && + avatarToCrop && } { !userInfo -- cgit v1.2.3